lincoln-lil commented on code in PR #21704:
URL: https://github.com/apache/flink/pull/21704#discussion_r1089959451
##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/stream/sql/agg/AggregateTest.xml:
##########
@@ -233,6 +233,86 @@ GroupAggregate(groupBy=[b], select=[b, SUM(a) AS EXPR$1])
+- Exchange(distribution=[hash[b]])
+- Calc(select=[a, b], where=[SEARCH(a, Sarg[(0.1..10)])])
+- LegacyTableSourceScan(table=[[default_catalog, default_database,
MyTable, source: [TestTableSource(a, b, c, proctime, rowtime)]]], fields=[a, b,
c, proctime, rowtime])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testCountStart">
+ <Resource name="sql">
+ <![CDATA[SELECT COUNT(*) FROM src]]>
+ </Resource>
+ <Resource name="ast">
+ <![CDATA[
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
++- LogicalProject($f0=[0])
+ +- LogicalTableScan(table=[[default_catalog, default_database, src]])
+]]>
+ </Resource>
+ <Resource name="optimized exec plan">
+ <![CDATA[
+GroupAggregate(select=[COUNT(*) AS EXPR$0])
++- Exchange(distribution=[single])
+ +- Calc(select=[0 AS $f0])
+ +- TableSourceScan(table=[[default_catalog, default_database, src,
project=[id], metadata=[]]], fields=[id])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testCountStartWithMetadata">
+ <Resource name="sql">
+ <![CDATA[SELECT COUNT(*) FROM src]]>
+ </Resource>
+ <Resource name="ast">
+ <![CDATA[
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
++- LogicalProject($f0=[0])
+ +- LogicalTableScan(table=[[default_catalog, default_database, src]])
+]]>
+ </Resource>
+ <Resource name="optimized exec plan">
+ <![CDATA[
+GroupAggregate(select=[COUNT(*) AS EXPR$0])
++- Exchange(distribution=[single])
+ +- Calc(select=[0 AS $f0])
+ +- TableSourceScan(table=[[default_catalog, default_database, src,
project=[id], metadata=[]]], fields=[id])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testCountStartWithMetadataOnly">
+ <Resource name="sql">
+ <![CDATA[SELECT COUNT(*) FROM src]]>
+ </Resource>
+ <Resource name="ast">
+ <![CDATA[
+LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
++- LogicalProject($f0=[0])
+ +- LogicalTableScan(table=[[default_catalog, default_database, src]])
+]]>
+ </Resource>
+ <Resource name="optimized exec plan">
+ <![CDATA[
+GroupAggregate(select=[COUNT(*) AS EXPR$0])
++- Exchange(distribution=[single])
+ +- Calc(select=[0 AS $f0])
+ +- TableSourceScan(table=[[default_catalog, default_database, src,
project=[], metadata=[cnt]]], fields=[cnt])
Review Comment:
This is because current `TestValuesSource` implementation uses a reverse
order linked hash map when converting readable meta data to an ordered map, for
the projection rule it always chooses the first column returned from the table
source (but the returned rowtype is determined by the table source's
implementation). For this fix, I prefer not to modify the current
`TestValuesSource` implementation to avoid too many irrelevant test changes,
WDYT?
--
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]