snuyanzin commented on code in PR #28316:
URL: https://github.com/apache/flink/pull/28316#discussion_r3488495586
##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/rules/logical/SimplifyJoinConditionRuleTest.xml:
##########
@@ -59,15 +59,19 @@ LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
<![CDATA[
LogicalProject(a=[$0])
+- LogicalFilter(condition=[=($1, CASE(IS NULL($5), 0:BIGINT, $5))])
- +- LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))],
joinType=[left])
+ +- LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($0, $3), IS NOT DISTINCT
FROM($1, $4))], joinType=[left])
:- LogicalTableScan(table=[[default_catalog, default_database,
MyTable1]])
- +- LogicalAggregate(group=[{0, 1}], EXPR$0=[COUNT()])
- +- LogicalProject(a=[$3], b=[$4])
- +- LogicalJoin(condition=[AND(=($0, $3), OR(<($0, 2), =($4, 5)))],
joinType=[inner])
- :- LogicalTableScan(table=[[default_catalog, default_database,
MyTable2]])
- +- LogicalAggregate(group=[{0, 1}])
- +- LogicalProject(a=[$0], b=[$1])
- +- LogicalTableScan(table=[[default_catalog,
default_database, MyTable1]])
+ +- LogicalProject(a=[$0], b=[$1], EXPR$0=[CASE(IS NOT NULL($4), $4, 0)])
Review Comment:
Here and in other places: Calcite fixed COUNT bug in correlated queries.
The COUNT bug: decorrelating an aggregate subquery via GROUP BY + LEFT JOIN
gives NULL for outer rows with no match, but scalar COUNT over empty input must
be 0 — so COUNT-family aggregates return wrong results.
Also more details at https://issues.apache.org/jira/browse/CALCITE-7010
--
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]