Rion Williams created FLINK-41261:
-------------------------------------

             Summary: Support ORDER BY in ARRAY_AGG
                 Key: FLINK-41261
                 URL: https://issues.apache.org/jira/browse/FLINK-41261
             Project: Flink
          Issue Type: New Feature
          Components: Table SQL / Planner
            Reporter: Rion Williams


FLINK-41260 rejects ARRAY_AGG(x ORDER BY y) during validation, because the 
runtime ignored the ordering. Postgres, BigQuery and Snowflake support the 
clause.

Supporting it needs:
* the call to resolve to Flink's ARRAY_AGG with the ORDER BY kept as the 
AggregateCall collation, instead of keeping Calcite's 
SqlLibraryOperators.ARRAY_AGG (whose ORDERED_FUNCTION syntax SymbolUtil cannot 
serialize);
* the collation in the compiled plan, since AggregateCallJsonSerializer does 
not write it today, with a restore test;
* an accumulator that keeps the sort keys and orders the elements on getValue, 
with retraction support for streaming. Today the accumulator holds only the 
values (the reason given in FLINK-21949).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to