Anish Mahto created SPARK-57378:
-----------------------------------

             Summary: Implement SCD2 Batch Processor; Merge Reconciled Rows 
into Aux and Target Tables
                 Key: SPARK-57378
                 URL: https://issues.apache.org/jira/browse/SPARK-57378
             Project: Spark
          Issue Type: Sub-task
          Components: Declarative Pipelines
    Affects Versions: 4.3.0
            Reporter: Anish Mahto


{*}Preamble{*}:

The SCD type 2 flow is a foreachBatch streaming query on an input 
change-data-feed, and is responsible for reconciling the incoming change data 
onto some target table that follows SCD2 replication semantics.

SCD2 flows also maintain an "auxiliary" table to keep track of early-arriving 
out-of-order received events state. Each microbatch will need to reconcile 
against this auxiliary table as well, and update the auxiliary table's state 
appropriately for future microbatches.

*Merge Reconciled Rows into Aux and Target Tables*

Once we have the full set of rows affected by the incoming microbatch in their 
post-reconciliation state, with redundant rows dropped, we're ready to persist 
this set of rows back to the aux/target tables.

This is three step process:
 # Tag whether a row should land in the aux or target table, depending on what 
type of row it is. No-op upserts and tombstones go to aux, op upserts go to 
target table.
 # Merge rows headed for the aux into the aux table. Drop rows from the aux if 
they have been promoted to the target table or made redundant
 # Merge rows headed for the target table. Drop rows from the target table if 
they have been demoted to the aux table.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to