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

   ### Feature Request / Improvement
   
   ## Prior Context on Iceberg CDC
   
   Here are the steps for today's Iceberg CDC procedure:
   1. User calls `create_changelog_view` on say table `t`
   2. This invokes `CreateChangelogViewProcedure#call` 
([src](https://github.com/apache/iceberg/blob/c44bd8e7c183cf92339939f2aff5ca2aa2a0fd3d/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/procedures/CreateChangelogViewProcedure.java#L147))
 with the parameters provided
   3. Iceberg reads `t.changes` (see Spark 
[docs](https://spark.apache.org/docs/latest/sql-v2-data-sources.html#read-path) 
for how Spark actually reads a source)
      - This goes through `SparkCatalog` which special cases CDC as 
`SparkChangelogTable`
      - This goes through the scan builder `SparkChangelogScanBuilder` which 
returns the scan `SparkChangelogScan`
      - This scan 
([src](https://github.com/apache/iceberg/blob/c44bd8e7c183cf92339939f2aff5ca2aa2a0fd3d/core/src/main/java/org/apache/iceberg/BaseIncrementalScan.java#L126))
 will form `ChangelogScanTask`s by looping through the relevant manifest files 
and adding one of`{BaseAddedRowsScanTask, BaseDeletedDataFileScanTask}` 
([src](https://github.com/apache/iceberg/blob/c44bd8e7c183cf92339939f2aff5ca2aa2a0fd3d/core/src/main/java/org/apache/iceberg/BaseIncrementalChangelogScan.java#L156)).
      - These tasks are then grouped by size etc. to form 
`Iterable<ScanTaskGroup<ChangelogScanTask>>`
      - Each task group ends up in one input partition 
([src](https://github.com/apache/iceberg/blob/c44bd8e7c183cf92339939f2aff5ca2aa2a0fd3d/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkBatch.java#L97))
 which is then read by a spark row reader
   4. Iceberg then repartitions and sorts these rows so they end up in the same 
partition -> then apply the given iterator
   
   
   
   ### Query engine
   
   Spark
   
   ### Willingness to contribute
   
   - [x] I can contribute this improvement/feature independently
   - [ ] I would be willing to contribute this improvement/feature with 
guidance from the Iceberg community
   - [ ] I cannot contribute this improvement/feature 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