dawidwys commented on code in PR #26374:
URL: https://github.com/apache/flink/pull/26374#discussion_r2018821175


##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/stream/sql/ChangelogNormalizeOptimizationTest.xml:
##########
@@ -388,7 +428,7 @@ 
LogicalSink(table=[default_catalog.default_database.upsert_sink_table], fields=[
     <Resource name="optimized rel plan">
       <![CDATA[
 Sink(table=[default_catalog.default_database.upsert_sink_table], fields=[id, 
col1, col2], changelogMode=[NONE])
-+- ChangelogNormalize(key=[id], condition=[>(col1, 2)], 
changelogMode=[I,UB,UA,D])
++- ChangelogNormalize(key=[id], condition=[>(col1, 2)], changelogMode=[I,UA,D])

Review Comment:
   Before moving the rule, `changelogMode` was calculated before the condition 
was pushed into the `ChangelogNormalize`, thus there was a separate `Calc`. 
   
   `Calc` with a condition requires `UPDATE_BEFORE` thus `ChangelogNormalize` 
needed to emit `UB`.
   
   Now that the optimisation happens before calculating `changelogMode` there 
is no `Calc` which was pushed into the `ChangelogNormalize` and thus 
`ChangelogNormalize` does not need to emit `UB` anymore if the subsequent 
operations don't need it.
   
   I also double checked that we can skip `UB` with the filter within 
`ChangelogNormalize`. We either emit `UA` or `D` if the condition is not 
satisified for a given key.



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