gustavodemorais commented on code in PR #30173:
URL: https://github.com/apache/flink/pull/30173#discussion_r4773211077
##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/stream/sql/ToAppendTest.xml:
##########
@@ -53,8 +54,75 @@ LogicalProject(name=[$0])
<Resource name="optimized rel plan">
<![CDATA[
ProcessTableFunction(invocation=[TO_APPEND(TABLE(#0), DEFAULT(), DEFAULT())],
uid=[null], select=[name], rowType=[RecordType(VARCHAR(2147483647) name)],
changelogMode=[I])
-+- Calc(select=[name], changelogMode=[I,UA,PD])
- +- TableSourceScan(table=[[default_catalog, default_database,
upsert_source]], fields=[id, name], changelogMode=[I,UA,PD])
++- Calc(select=[name], changelogMode=[I,UA])
+ +- ChangelogFilter(keep=[I,UA], changelogMode=[I,UA])
+ +- TableSourceScan(table=[[default_catalog, default_database,
upsert_source]], fields=[id, name], changelogMode=[I,UA,PD])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testJoinFollowedByAggregation">
+ <Resource name="sql">
+ <![CDATA[SELECT status, COUNT(*) AS payments, SUM(amount) AS total FROM
TO_APPEND(input => TABLE payment_status) GROUP BY status]]>
+ </Resource>
+ <Resource name="ast">
+ <![CDATA[
+LogicalAggregate(group=[{0}], payments=[COUNT()], total=[SUM($1)])
++- LogicalProject(status=[$1], amount=[$0])
+ +- LogicalTableFunctionScan(invocation=[TO_APPEND(TABLE(#0), DEFAULT(),
DEFAULT())], rowType=[RecordType(INTEGER amount, VARCHAR(2147483647) status)])
+ +- LogicalProject(amount=[$0], status=[$1])
+ +- LogicalProject(amount=[$1], status=[$3])
+ +- LogicalFilter(condition=[>($1, 0)])
+ +- LogicalJoin(condition=[=($0, $2)], joinType=[inner])
+ :- LogicalTableScan(table=[[default_catalog,
default_database, payments]])
+ +- LogicalTableScan(table=[[default_catalog,
default_database, upsert_source]])
+]]>
+ </Resource>
+ <Resource name="optimized rel plan">
+ <![CDATA[
+GroupAggregate(groupBy=[status], select=[status, COUNT(*) AS payments,
SUM(amount) AS total], changelogMode=[I,UA])
++- Exchange(distribution=[hash[status]], changelogMode=[I])
+ +- ProcessTableFunction(invocation=[TO_APPEND(TABLE(#0), DEFAULT(),
DEFAULT())], uid=[null], select=[amount,status], rowType=[RecordType(INTEGER
amount, VARCHAR(2147483647) status)], changelogMode=[I])
+ +- Calc(select=[amount, name AS status], changelogMode=[I,UA])
+ +- ChangelogFilter(keep=[I,UA], changelogMode=[I,UA])
+ +- Join(joinType=[InnerJoin], where=[=(order_id, id)],
select=[order_id, amount, id, name], leftInputSpec=[NoUniqueKey],
rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,PD])
+ :- Exchange(distribution=[hash[order_id]], changelogMode=[I])
+ : +- Calc(select=[order_id, amount], where=[>(amount, 0)],
changelogMode=[I])
+ : +- TableSourceScan(table=[[default_catalog,
default_database, payments, filter=[]]], fields=[order_id, amount],
changelogMode=[I])
+ +- Exchange(distribution=[hash[id]], changelogMode=[I,UA,PD])
+ +- TableSourceScan(table=[[default_catalog,
default_database, upsert_source]], fields=[id, name], changelogMode=[I,UA,PD])
Review Comment:
done
--
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]