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

   ### Describe the issue this Pull Request addresses
   
   Closes #20864.
   
   A Flink streaming reader can start before the first writer creates the Hudi 
table. With Source V2 enabled, building the data stream fails because the table 
meta client is still null. Split discovery also checks for the table only in 
its constructor, so a discoverer created before the first write keeps returning 
empty batches.
   
   ### Summary and Changelog
   
   - Use the Flink DDL schema and configured table name to plan an unbounded 
source when the table does not exist. Build the bucket pruning function only 
for bounded reads.
   - Look up the meta client on each discovery poll until the table exists, 
then cache it. Polls before table creation leave the enumerator offset 
unchanged.
   - Exercise graph construction for both source implementations with a 
bucket-key equality predicate. Verify that the same discoverer picks up the 
first commit after an empty poll and does not emit its splits again when 
polling from the returned offset.
   
   ### Impact
   
   With the default schema evolution setting, a Source V2 streaming job can 
start before table creation and discover data after the first write. Bounded 
reads still require an initialized table.
   
   ### Risk Level
   
   Low. The change uses the existing periodic split discovery and meta client 
lookup. All 69 tests across `TestHoodieTableSource`, `TestHoodieSource`, 
`TestDefaultHoodieSplitDiscover`, and `TestPrimaryKeyPruners` passed with Flink 
2.2.1 and JDK 17, including bounded bucket pruning.
   
   ### Documentation Update
   
   None.
   
   ### Contributor's checklist
   
   - [ ] 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