LiHao created CALCITE-5828: ------------------------------ Summary: RelNode to SqlNode, when converting the Order field, a judgment should be added to determine whether it is in the Window Key: CALCITE-5828 URL: https://issues.apache.org/jira/browse/CALCITE-5828 Project: Calcite Issue Type: Bug Reporter: LiHao Assignee: LiHao
*RelNode to SqlNode, when converting the Order field, a judgment should be added to determine whether it is in the Window.* _Example_ source sql: {quote}SELECT RANK() OVER (ORDER BY 1 + "col1") FROM "table" GROUP BY "col1"{quote} after calcite: {quote}SELECT RANK() OVER (ORDER BY 1 NULLS LAST) AS \"$0\" FROM "table" GROUP BY "col1"{quote} expect return: {quote}SELECT RANK() OVER (ORDER BY 1 + "col1") FROM "table" GROUP BY "col1"{quote} I just investigated Presto, if the order by in the window function is not allowed to use ordinal numbers, but it is possible to write ordinal numbers in ordinary order by. So I think calcite should have a judgment in interface SqlConformance, {{boolean isSortByOrdinalInWindow();}} In addition, I don't think [CALCITE-5724|https://issues.apache.org/jira/browse/CALCITE-5724] mentions this, but it's something like. [Presto Window Function|https://prestodb.io/docs/current/functions/window.html?highlight=window%20order#] -- This message was sent by Atlassian Jira (v8.20.10#820010)