jiwen624 opened a new issue, #19154:
URL: https://github.com/apache/iceberg/issues/19154

   ### Apache Iceberg version
   
   None
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   When `IcebergSource` streams from a branch that doesn't exist, the automatic 
starting strategies initialize the position from main, but later discovery 
looks up the branch and finds no snapshot. If the saved position is non-null, 
planning throws `Invalid last enumerated position for an empty table: not 
null`, which doesn't mention the branch, and the job fails once 
`max-allowed-planning-failures` (default 3) is exceeded.
   
   - `TABLE_SCAN_THEN_INCREMENTAL`: plans main's files, so rows from main may 
be emitted before the failure.
   - `INCREMENTAL_FROM_LATEST_SNAPSHOT_EXCLUSIVE`: fails whenever main has a 
current snapshot.
   - `INCREMENTAL_FROM_LATEST_SNAPSHOT`, `INCREMENTAL_FROM_EARLIEST_SNAPSHOT`: 
fail if the chosen start snapshot has a parent ID (e.g. main has 2+ snapshots, 
or older snapshots were expired). Otherwise they wait.
   
   When the table has no current snapshot, these strategies wait and read the 
branch once it's created, so failing fast would change existing behavior. 
Simply treating a missing branch as empty doesn't work either: 
`TABLE_SCAN_THEN_INCREMENTAL` then skips its initial scan once the branch 
appears and misses still-live files from expired snapshots. Waiting would need 
the source to stay uninitialized until the branch exists.
   
   Should a missing branch fail, or wait for the branch to be created? A 
clearer error naming the branch would help either way. Found while working on 
#19099, which keeps this behavior unchanged.
   
   ### Willingness to contribute
   
   - [x] I can contribute a fix for this bug independently
   - [x] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to