[ 
https://issues.apache.org/jira/browse/FLINK-38832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hongshun Wang updated FLINK-38832:
----------------------------------
    Description: 
Since 2.2.0, explain of this statement changes: +select count * from log_table+ 

 

In 2.1, only first field of source is needed, thus will be pushed down.
{code:java}
FlinkLogicalCalc(select=[EXPR$0])
+- FlinkLogicalAggregate(group=[{0}], EXPR$0=[COUNT()])
   +- FlinkLogicalTableSourceScan(table=[[testcatalog, defaultdb, log_table, 
project=[id]]], fields=[id])


HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS EXPR$0])
+- Exchange(distribution=[single])
   +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
      +- TableSourceScan(table=[[testcatalog, defaultdb, log_table, 
project=[id]]], fields=[id]) {code}
 

in 2.2, id is not pushed down to source.
{code:java}
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+- LogicalProject(exprs=[[0]])
   +- LogicalTableScan(table=[[testcatalog, defaultdb, test_log_table]])


HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS EXPR$0])
+- Exchange(distribution=[single])
   +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
      +- TableSourceScan(table=[[testcatalog, defaultdb, log_table]], 
fields=[id, address, name]) {code}
FlinkLogicalAggregate is changed to LogicalProject.

 

  was:
Since 2.2.0, explain of this statement changes: +select count(*) from 
log_table+ 

 

In 2.1, only first field of source is needed, thus will be pushed down.
{code:java}
FlinkLogicalCalc(select=[EXPR$0])
+- FlinkLogicalAggregate(group=[{0}], EXPR$0=[COUNT()])
   +- FlinkLogicalTableSourceScan(table=[[testcatalog, defaultdb, log_table, 
project=[id]]], fields=[id])


HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS EXPR$0])
+- Exchange(distribution=[single])
   +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
      +- TableSourceScan(table=[[testcatalog, defaultdb, log_table, 
project=[id]]], fields=[id]) {code}
 

in 2.2, id is not pushed down to source.
{code:java}
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
+- LogicalProject(exprs=[[0]])
   +- LogicalTableScan(table=[[testcatalog, defaultdb, test_log_table]])


HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS EXPR$0])
+- Exchange(distribution=[single])
   +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
      +- TableSourceScan(table=[[testcatalog, defaultdb, log_table]], 
fields=[id, address, name]) {code}
FlinkLogicalAggregate is changed to LogicalProject.

 


> Planner of count(*) changes
> ---------------------------
>
>                 Key: FLINK-38832
>                 URL: https://issues.apache.org/jira/browse/FLINK-38832
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 2.2.0
>            Reporter: Hongshun Wang
>            Priority: Major
>             Fix For: 2.2.1
>
>
> Since 2.2.0, explain of this statement changes: +select count * from 
> log_table+ 
>  
> In 2.1, only first field of source is needed, thus will be pushed down.
> {code:java}
> FlinkLogicalCalc(select=[EXPR$0])
> +- FlinkLogicalAggregate(group=[{0}], EXPR$0=[COUNT()])
>    +- FlinkLogicalTableSourceScan(table=[[testcatalog, defaultdb, log_table, 
> project=[id]]], fields=[id])
> HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS EXPR$0])
> +- Exchange(distribution=[single])
>    +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
>       +- TableSourceScan(table=[[testcatalog, defaultdb, log_table, 
> project=[id]]], fields=[id]) {code}
>  
> in 2.2, id is not pushed down to source.
> {code:java}
> LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
> +- LogicalProject(exprs=[[0]])
>    +- LogicalTableScan(table=[[testcatalog, defaultdb, test_log_table]])
> HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS EXPR$0])
> +- Exchange(distribution=[single])
>    +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
>       +- TableSourceScan(table=[[testcatalog, defaultdb, log_table]], 
> fields=[id, address, name]) {code}
> FlinkLogicalAggregate is changed to LogicalProject.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to