Skip to content

[HUDI-4620] No expected exception is thrown when create hudi table without primaryKey#6395

Closed
watermelon12138 wants to merge 1 commit intoapache:masterfrom
watermelon12138:fixCreateTableWithoutPrimaryKey
Closed

[HUDI-4620] No expected exception is thrown when create hudi table without primaryKey#6395
watermelon12138 wants to merge 1 commit intoapache:masterfrom
watermelon12138:fixCreateTableWithoutPrimaryKey

Conversation

@watermelon12138
Copy link
Contributor

@watermelon12138 watermelon12138 commented Aug 15, 2022

Change Logs

No expected exception is thrown when create hudi table without primaryKey.

Expected exception:
“java.lang.IllegalArgumentException: No primaryKey is specified."

Thrown exception now:
“Can't find primaryKey uuid in root”

Impact

Describe any public API or user-facing feature change or any performance impact.

Risk level: none | low | medium | high

Choose one. If medium or high, explain what verification was done to mitigate the risks.

Contributor's checklist

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

@hudi-bot
Copy link
Collaborator

CI report:

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

@yihua yihua self-assigned this Sep 6, 2022
@yihua yihua added priority:critical Production degraded; pipelines stalled engine:spark Spark integration labels Sep 6, 2022
.withSqlKey("primaryKey")
.withHoodieKey(DataSourceWriteOptions.RECORDKEY_FIELD.key)
.withTableConfigKey(HoodieTableConfig.RECORDKEY_FIELDS.key)
.defaultValue(DataSourceWriteOptions.RECORDKEY_FIELD.defaultValue())
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we also remove the default value in KeyGeneratorOptions so that Spark SQL has consistent behavior with Spark datasource?

public static final ConfigProperty<String> RECORDKEY_FIELD_NAME = ConfigProperty
      .key("hoodie.datasource.write.recordkey.field")
      .defaultValue("uuid")
      .withDocumentation("Record key field. Value to be used as the `recordKey` component of `HoodieKey`.\n"
          + "Actual value will be obtained by invoking .toString() on the field value. Nested fields can be specified using\n"
          + "the dot notation eg: `a.b.c`");

cc @YannByron @nsivabalan

.withSqlKey("primaryKey")
.withHoodieKey(DataSourceWriteOptions.RECORDKEY_FIELD.key)
.withTableConfigKey(HoodieTableConfig.RECORDKEY_FIELDS.key)
.defaultValue(DataSourceWriteOptions.RECORDKEY_FIELD.defaultValue())
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @watermelon12138, I just noticed that this change is already covered by #5771. I'll close this one as a duplicate. Feel free to review the other PR.

@yihua yihua closed this Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine:spark Spark integration priority:critical Production degraded; pipelines stalled

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants