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

Flink Jira Bot updated FLINK-16320:
-----------------------------------
      Labels: auto-deprioritized-major auto-deprioritized-minor  (was: 
auto-deprioritized-major stale-minor)
    Priority: Not a Priority  (was: Minor)

This issue was labeled "stale-minor" 7 days ago and has not received any 
updates so it is being deprioritized. If this ticket is actually Minor, please 
raise the priority and ask a committer to assign you the issue or revive the 
public discussion.


> Can not use sub-queries in the VALUES clause 
> ---------------------------------------------
>
>                 Key: FLINK-16320
>                 URL: https://issues.apache.org/jira/browse/FLINK-16320
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.11.0
>            Reporter: Dawid Wysakowicz
>            Priority: Not a Priority
>              Labels: auto-deprioritized-major, auto-deprioritized-minor
>
> {code}
> StreamExecutionEnvironment sEnv = 
> StreamExecutionEnvironment.getExecutionEnvironment();
> StreamTableEnvironment tableEnvironment = StreamTableEnvironment.create(
>       sEnv,
>       EnvironmentSettings.newInstance().useBlinkPlanner().build());
> Table table = tableEnvironment.sqlQuery("SELECT * FROM (VALUES(1), (SELECT 
> 1))");
> tableEnvironment.toRetractStream(table, Row.class).print();
> System.out.println(tableEnvironment.explain(table));
> {code}
> Produces:
> {code}
> == Optimized Logical Plan ==
> Union(all=[true], union=[EXPR$0])
> :- Calc(select=[CAST(1) AS EXPR$0])
> :  +- Values(type=[RecordType(INTEGER ZERO)], tuples=[[{ 0 }]])
> +- Calc(select=[$f0 AS EXPR$0])
>    +- Join(joinType=[LeftOuterJoin], where=[true], select=[ZERO, $f0], 
> leftInputSpec=[NoUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey])
>       :- Exchange(distribution=[single])
>       :  +- Values(type=[RecordType(INTEGER ZERO)], tuples=[[{ 0 }]], 
> reuse_id=[1])
>       +- Exchange(distribution=[single])
>          +- GroupAggregate(select=[SINGLE_VALUE(EXPR$0) AS $f0])
>             +- Exchange(distribution=[single])
>                +- Calc(select=[1 AS EXPR$0])
>                   +- Reused(reference_id=[1])
> {code}
> which is wrong.
> Legacy planner fails with:
> {code}
> validated type:
> RecordType(INTEGER EXPR$0) NOT NULL
> converted type:
> RecordType(INTEGER NOT NULL EXPR$0) NOT NULL
> rel:
> LogicalProject(EXPR$0=[$0])
>   LogicalUnion(all=[true])
>     LogicalProject(EXPR$0=[1])
>       LogicalValues(tuples=[[{ 0 }]])
>     LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
>       LogicalProject(EXPR$0=[1])
>         LogicalValues(tuples=[[{ 0 }]])
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to