[HUDI-7423] Support table type name incase-sensitive when create table in sparksql #10703
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Logs
Support table type name incase-sensitive when create table in sparksql.
When many user create table would set table.type = MOR/Mor/Cow/COW according to Hudi document,like:
CREATE TABLE
hudi_test
.hudi_test29
(app_id
STRING COMMENT '应用id',message_id
STRING COMMENT '消息id',dt
INT,from
STRING,day
STRING COMMENT '日期分区',hour
INT COMMENT '小时分区')using hudi
tblproperties (
'primaryKey' = 'app_id,message_id',
'type' = 'MOR',
'preCombineField'='dt',
'hoodie.index.type' = 'BUCKET',
'hoodie.bucket.index.hash.field' = 'app_id,message_id',
'hoodie.bucket.index.num.buckets'=256,
'hoodie.datasource.hive_sync.table.strategy'='RT'
)
PARTITIONED BY (
day
,hour
);it would occur error as:
java.lang.IllegalArgumentException: No enum constant org.apache.hudi.common.model.HoodieTableType.MOR
at java.lang.Enum.valueOf(Enum.java:238)
at org.apache.hudi.common.model.HoodieTableType.valueOf(HoodieTableType.java:30)
at org.apache.hudi.common.table.HoodieTableMetaClient$PropertyBuilder.setTableType(HoodieTableMetaClient.java:833)
at org.apache.hudi.common.table.HoodieTableMetaClient$PropertyBuilder.fromProperties(HoodieTableMetaClient.java:1009)
at org.apache.spark.sql.catalyst.catalog.HoodieCatalogTable.initHoodieTable(HoodieCatalogTable.scala:219)
at org.apache.spark.sql.hudi.command.CreateHoodieTableCommand.run(CreateHoodieTableCommand.scala:70)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:80)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:78)
at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:89)
at org.apache.spark.sql.execution.QueryExecution$$anonfun$eagerlyExecuteCommands$1.$anonfun$applyOrElse$1(QueryExecution.scala:110)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
It is not friendly to user which must set table=mor/cow for users. So it is better make the config incase-sensitive to users
Impact
low
Risk level (write none, low medium or high below)
low
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change
ticket number here and follow the instruction to make
changes to the website.
Contributor's checklist