Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-7423] Support table type name incase-sensitive when create table in sparksql #10703

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

xuzifu666
Copy link
Contributor

@xuzifu666 xuzifu666 commented Feb 19, 2024

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

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@xuzifu666 xuzifu666 changed the title [HUDI-7423] Support table type name case-sensitive when create table in sparksql [HUDI-7423] Support table type name incase-sensitive when create table in sparksql Feb 19, 2024
@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@XuQianJin-Stars XuQianJin-Stars added the spark Issues related to spark label Feb 20, 2024
Copy link
Contributor

@bvaradar bvaradar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bvaradar bvaradar merged commit ad8a15a into apache:master Feb 20, 2024
33 checks passed
yihua pushed a commit that referenced this pull request Feb 27, 2024
…e in sparksql (#10703)

* [HUDI-7423] Support table type name case-sensitive when create table in sparksql

* add comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spark Issues related to spark
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants