Skip to content

Conversation

@yihua
Copy link
Contributor

@yihua yihua commented Jan 18, 2022

What is the purpose of the pull request

Existing SparkHoodieTableFileIndex requires checking against the key generator class name to generate the partition schema. This logic introduces NPE when the key generator class name is not present in hoodie.properties. This PR fixes the issue so that if the key generator class name is not present, default logic is used.

Stacktrace:

scala> val basePath = "/tmp/hoodie/hudi-test-topic"
basePath: String = /tmp/hoodie/hudi-test-topic


scala> val df = spark.read.format("hudi").load(basePath)
df: org.apache.spark.sql.DataFrame = [_hoodie_commit_time: string, _hoodie_commit_seqno: string ... 15 more fields]


scala> df.count
java.lang.NullPointerException
  at org.apache.hudi.SparkHoodieTableFileIndex._partitionSchemaFromProperties$lzycompute(SparkHoodieTableFileIndex.scala:83)
  at org.apache.hudi.SparkHoodieTableFileIndex._partitionSchemaFromProperties(SparkHoodieTableFileIndex.scala:77)
  at org.apache.hudi.SparkHoodieTableFileIndex.partitionSchema(SparkHoodieTableFileIndex.scala:118)
  at org.apache.hudi.SparkHoodieTableFileIndex.parsePartitionColumnValues(SparkHoodieTableFileIndex.scala:218)

Brief change log

  • Changes the way of matching key generator class name in SparkHoodieTableFileIndex

Verify this pull request

Verified by loading a Hudi MOR table written by Kafka Connect Sink for Hudi, without having key generator class name in hoodie.properties, with Spark datasource and the table can be read successfully.

scala> val basePath = "/tmp/hoodie/hudi-test-topic"
basePath: String = /tmp/hoodie/hudi-test-topic

scala> val df = spark.read.format("hudi").load(basePath)
df: org.apache.spark.sql.DataFrame = [_hoodie_commit_time: string, _hoodie_commit_seqno: string ... 15 more fields]

scala> df.count
res0: Long = 1500       

Committer checklist

  • Has a corresponding JIRA in PR title & commit

  • Commit message is descriptive of the change

  • CI is green

  • Necessary doc changes done or have another open PR

  • For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.

@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

Copy link
Contributor

@nsivabalan nsivabalan left a comment

Choose a reason for hiding this comment

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

one nit question

@nsivabalan nsivabalan merged commit 4b90850 into apache:master Jan 21, 2022
@xushiyan xushiyan added the priority:critical Production degraded; pipelines stalled label Jan 23, 2022
@vinishjail97 vinishjail97 mentioned this pull request Jan 24, 2022
5 tasks
alexeykudinkin pushed a commit to onehouseinc/hudi that referenced this pull request Jan 25, 2022
vingov pushed a commit to vingov/hudi that referenced this pull request Jan 26, 2022
liusenhua pushed a commit to liusenhua/hudi that referenced this pull request Mar 1, 2022
vingov pushed a commit to vingov/hudi that referenced this pull request Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:critical Production degraded; pipelines stalled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants