yihua opened a new pull request, #20240:
URL: https://github.com/apache/hudi/pull/20240

   ### Describe the issue this Pull Request addresses
   
   issue: #20235, part of #16933
   
   `HoodieFileIndex.getConfigProperties` rebuilds a catalog identifier from 
`hoodie.table.name` plus `hoodie.database.name`, falling back to the session's 
current database, and calls `spark.catalog.tableExists` on it to pick up the 
simple bucket index TBLPROPERTIES. When the table records no database name that 
guess is usually wrong: a catalog that rejects the session database fails every 
qualified read, and a same-named table in the session database can hand its 
bucket count to a different table, which makes bucket pruning drop rows 
silently.
   
   ### Summary and Changelog
   
   The catalog is consulted only when the read already declares 
`hoodie.index.type=BUCKET` through the datasource options or the session conf. 
A read with no bucket index declared never calls the catalog. When the lookup 
does run it is best effort: a catalog error is logged at WARN and the merge is 
skipped, so a session-wide bucket index setting cannot fail a read either. A 
declared bucket read against a healthy catalog still merges the entry's 
properties, and the schema-on-read path still carries TBLPROPERTIES as options.
   
   `TestHoodieFileIndex` gains three cases: a read without a declared bucket 
index never calls `tableExists` even when the catalog would throw (fails before 
this change with the thrown exception), a read that declares a bucket index 
still merges the entry's bucket count, and a declared bucket read whose catalog 
throws proceeds without the merge.
   
   This is the narrow alternative to #20236. The longer-term fix is to persist 
the bucket index definition in the table (#14425) and drop both the catalog 
lookup and the database-name guess (#16933).
   
   ### Impact
   
   Reads that do not declare a bucket index stop touching the catalog. A 
catalog read of a simple bucket index table now needs 
`hoodie.index.type=BUCKET` on the read or in the session conf to keep bucket 
pruning, unless the options already carry it.
   
   ### Risk Level
   
   low. The behavior change is the condition on the catalog lookup and treating 
its failure as a skipped merge.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


-- 
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]

Reply via email to