Timo Theusner created FLINK-40271:
-------------------------------------

             Summary: Group window properties produce invalid SQL in 
QueryOperation#asSerializableString
                 Key: FLINK-40271
                 URL: https://issues.apache.org/jira/browse/FLINK-40271
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
            Reporter: Timo Theusner


Table API group-window properties ({{{}$("w").rowtime(){}}}, 
{{{}$("w").proctime(){}}}, {{{}$("w").start(){}}}, {{$("w").end())}} are not 
translated to the corresponding windowing-TVF output columns when a 
{{WindowAggregateQueryOperation}} is serialized back to SQL. Instead, the 
window alias is emitted as if it were a column reference, producing SQL that 
does not parse. This has the effect that the example from the official docs do 
not work: 
{code:java}
Table t = env.from("orders")
        .window(Tumble.over(lit(1).minutes()).on($("ts")).as("w"))
        .groupBy($("product_id"), $("w"))
        .select($("product_id"), $("w").start(), $("w").end(), 
$("w").rowtime(), $("price").sum()); 

String sql = t.getQueryOperation()
              .asSerializableString(DefaultSqlFactory.INSTANCE);
env.sqlQuery(sql); // fails
{code}
Corresponding error message:
{code:java}
org.apache.flink.table.api.ValidationException: SQL validation failed. Column 
'w' not found in any table {code}



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

Reply via email to