You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Flink Jira Bot (Jira)" <ji...@apache.org> on 2022/01/02 10:40:00 UTC

[jira] [Updated] (FLINK-16320) Can not use sub-queries in the VALUES clause

     [ 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 stale-minor  (was: auto-deprioritized-major)

I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help the community manage its development. I see this issues has been marked as Minor but is unassigned and neither itself nor its Sub-Tasks have been updated for 180 days. I have gone ahead and marked it "stale-minor". If this ticket is still Minor, please either assign yourself or give an update. Afterwards, please remove the label or in 7 days the issue will be deprioritized.


> 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: Minor
>              Labels: auto-deprioritized-major, stale-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)