danny0405 opened a new issue, #20875:
URL: https://github.com/apache/hudi/issues/20875

   ### Feature Description
   
   Hudi already exposes row-level CDC through Hudi-specific query options. 
Spark 4.2 adds a standard DataSource V2 interface for SQL CHANGES and DataFrame 
change reads. Expose the existing Hudi change feed through this interface so 
downstream Spark jobs can consume inserts, updates, and deletes without 
Hudi-specific APIs. This is a read-side follow-up to #20401, not a replacement 
for Hudi CDC or latest-state incremental reads.
   
   **Proposed scope**
   - Implement TableCatalog.loadChangelog for supported CDC-enabled Hudi tables 
and reuse the existing CDC extraction path. Start with bounded reads, then add 
checkpointed streaming reads.
   - Map events to Spark's _change_type, _commit_version, and 
_commit_timestamp, including update preimages and postimages for supported 
configurations. Honor the requested inclusive/exclusive range boundaries and 
expose the correct row identity for post-processing, including partition path 
and record key when keys are partition-scoped.
   - Define a commit-order and offset contract. Do not reuse requested instant 
time as Spark event time when admitting commits in completion order. For 
streaming post-processing, keep each commit in one micro-batch and require 
strictly increasing timestamps across batches. Equal-timestamp commits can 
share a batch but must not straddle batches, or Spark can silently drop changes.
   - Report expired or unavailable CDC history explicitly rather than silently 
substituting a latest-state snapshot. Keep existing Hudi CDC behavior 
unchanged. Spark Auto CDC/SCD target support is out of scope.
   
   **Acceptance criteria**
   - Spark SQL CHANGES and bounded DataFrame reads match existing Hudi CDC for 
inserts, updates, and hard deletes, including exact range boundaries, duplicate 
keys in different partitions, and a partition move on a globally keyed table.
   - With streaming post-processing enabled, verify exact emitted changes after 
a restart, including a late-completing instant and equal completion timestamps 
at a batch-size boundary. Reuse ordering cases from #20679 where applicable. 
Compaction must not emit unchanged rows as user changes.
   - Verify an explicit error at an expired-history boundary. Document 
supported table configurations and initial limitations.
   
   References: [Spark 4.2 release 
notes](https://spark.apache.org/releases/spark-release-4-2-0.html), [Spark 
Changelog 
contract](https://spark.apache.org/docs/4.2.0/api/java/org/apache/spark/sql/connector/catalog/Changelog.html),
 and Hudi streaming chaining #20407.**What the feature achieves:**
   
   **Why this feature is needed:**
   
   
   ### User Experience
   
   Users keep enabling Hudi CDC as they do today. For supported tables, they 
can then use Spark's standard SQL CHANGES or DataFrame change-read APIs. 
Bounded reads come first; streaming reads use Spark checkpoints and fail 
explicitly if the requested change history is no longer available.**How users 
will use this feature:**
   - Configuration changes needed
   - API changes
   - Usage examples
   
   
   ### Hudi RFC Requirements
   
   Related work: #20401 (RFC-112 tracking). This adds a public Spark connector 
capability but does not propose a storage format change. No separate RFC is 
linked yet; review the commit-order, row-identity, and checkpoint contract 
before enabling streaming.**RFC PR link:** (if applicable)
   
   **Why RFC is/isn't needed:**
   - Does this change public interfaces/APIs? (Yes/No)
   - Does this change storage format? (Yes/No)
   - Justification:
   


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