yihua commented on code in PR #20240:
URL: https://github.com/apache/hudi/pull/20240#discussion_r4225902690
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieFileIndex.scala:
##########
@@ -655,14 +657,20 @@ object HoodieFileIndex extends Logging {
properties.setProperty(PARTITIONPATH_FIELD.key,
HoodieTableConfig.getPartitionFieldPropForKeyGenerator(tableConfig).orElse(""))
properties.setProperty(HoodieTableConfig.PARTITION_EXTRACTOR_CLASS.key(),
tableConfig.getPartitionExtractorClass.orElse(""))
- // for simple bucket index, we need to set the INDEX_TYPE,
BUCKET_INDEX_HASH_FIELD, BUCKET_INDEX_NUM_BUCKETS
- val database = getDatabaseName(tableConfig,
spark.catalog.currentDatabase)
- val tableName = tableConfig.getTableName
-
- if (spark.catalog.tableExists(database, tableName)) {
- val tableIdentifier = TableIdentifier(tableName, Some(database))
- val table = HoodieCatalogTable(spark, tableIdentifier)
- table.catalogProperties.foreach(kv => properties.setProperty(kv._1,
kv._2))
+ // The catalog entry only completes the simple bucket index settings
(hash field and bucket count), which
+ // hoodie.properties does not record, so it is consulted only when the
read declares a bucket index.
+ if (isBucketIndexDeclared(properties)) {
+ val database = getDatabaseName(tableConfig,
spark.catalog.currentDatabase)
+ val tableName = tableConfig.getTableName
+ try {
+ if (spark.catalog.tableExists(database, tableName)) {
+ val table = HoodieCatalogTable(spark, TableIdentifier(tableName,
Some(database)))
+ table.catalogProperties.foreach(kv =>
properties.setProperty(kv._1, kv._2))
Review Comment:
Done, the merge now copies only the bucket index options (index type, engine
type, hash field, bucket count, query pruning flag) from the catalog entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]