[HUDI-8504] Fix missing database config when building Hudi configs in Spark #12238
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
The current implementation missed database when building hudi config, which will lead to obtain the incorrect table even though the table exists. Such as the case of
spark writing datahudi/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/InsertIntoHoodieTableCommand.scala
Line 97 in cea81e8
hudi/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala
Lines 251 to 254 in cea81e8
Because the value of
DATABASE_NAME.keyis lost whenbuildHoodieInsertConfig, sodatabaseNameis empty intableIdentifier.hudi/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala
Lines 667 to 670 in cea81e8
hudi/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala
Lines 674 to 680 in cea81e8
Then the table under the
databaseNamecannot be obtained or the table under thedefault databaseis obtained, it is obviously inconsistent with expectation.this PR fix this bug.
Impact
hudi-spark-common
Risk level (write none, low medium or high below)
Low
Documentation Update
None
Contributor's checklist