SEZ9 commented on issue #13407:
URL: https://github.com/apache/seatunnel/issues/13407#issuecomment-7245790146

   @Sachin-nsk Thanks, that answers both points, and there was nothing in your 
comment you were waiting on me for.
   
   1. **`primary_keys`**: stopping the job at startup, when the sink is created 
and before any row is written, is the right behaviour. Nothing more is needed 
here.
   
   2. **Batching**: the change from your earlier plan for the rewrite case 
makes sense. PostgreSQL can treat keys as equal that differ as Java values 
(your numeric `1.0` / `1.00` example). A repeat check on Java values therefore 
cannot guarantee that a rewritten statement never affects the same row twice. 
Executing every upsert row on its own with `reWriteBatchedInserts=true` is the 
safer choice. Reading the setting from the url and properties the way the 
PostgreSQL driver does is also fine. With rewriting disabled, executing the 
pending batch first when a row's key is already in it keeps the boundary 
explicit, as the thread asked.
   
   Two things are left, both on the batching point:
   
   - **Missed repeats with rewriting disabled**: the repeat check there still 
compares Java values and does not track keys containing NULL. Could you confirm 
that a missed repeat (e.g. `1.0` vs `1.00`) still ends with the correct final 
row in arrival order? Please also say whether `testUpdateConditionSql` covers 
such a case, or only keys that are equal in Java.
   - **Docs**: you mention the PR description now covers both settings. Could 
you confirm the EN/ZH docs also say that with `reWriteBatchedInserts=true` 
every upsert row is executed on its own when this option is set?
   
   <!-- streview-comment:2684 -->


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