Hi all,

I'd like to start a discussion on adding initial snapshot load to Spark 
streaming reads.

Today a Spark streaming query with a fresh checkpoint can only replay the 
table's history from the oldest ancestor snapshot. This is slow for long-lived 
tables, and it cannot work once snapshots have been expired. Currently there is 
no way to read all data files in the current snapshot before continuing 
incrementally, which is a common pattern in streaming tables and has been part 
of the Flink connector since v0.14.0 with StreamingStartingStrategy set to 
TABLE_SCAN_THEN_INCREMENTAL.

https://github.com/apache/iceberg/pull/18068 adds this feature to Spark 
streaming through a new `stream-from-snapshot` option:

  - unset (new default): initial snapshot load - read the current snapshot in 
full, then continue with new snapshots
  - “earliest" (current default): read snapshots starting from the oldest 
ancestor
  - “latest": only snapshots committed after stream startup
  - "<snapshot-id>": from that snapshot, inclusive

`stream-from-snapshot` and `stream-from-timestamp` would be mutually exclusive.

There is still an open question regarding if this behavior should be the new 
default. The PR currently makes initial snapshot load the default, which 
changes behavior for existing queries that start with a new checkpoint. The 
alternative is to keep today's default and make initial snapshot load opt-in.

Thanks,
Alex

Reply via email to