dawidwys commented on code in PR #25526:
URL: https://github.com/apache/flink/pull/25526#discussion_r1802563488
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/SqlCallSyntax.java:
##########
@@ -316,4 +316,23 @@ private String doUnParse(
CallSyntaxUtils.asSerializableOperand(operands.get(2)));
}
};
+
+ SqlCallSyntax OVER =
+ ((sqlName, operands) -> {
+ String projection = operands.get(0).asSerializableString();
+ String order = operands.get(1).asSerializableString();
+ String rangeBounds =
+ CallSyntaxUtils.overRangeToSerializableString(
+ operands.get(2), operands.get(3));
+ if (operands.size() == 4) {
+ return String.format("%s OVER(ORDER BY %s %s)",
projection, order, rangeBounds);
+ } else {
+ return String.format(
+ "%s OVER(PARTITION BY %s ORDER BY %s %s)",
+ projection,
+
CallSyntaxUtils.asSerializableOperand(operands.get(4)),
+ order,
+ rangeBounds);
+ }
Review Comment:
This is too high level to test or ask the questions you asked 😅 If you'd
like to check or fix sth in how `OVER` windows work in general we could create
a separate issue.
This covers only the unparsing and it unparses all supported cases. The
expected signature can be checked with
https://github.com/apache/flink/blob/1986cfe1cb3606fc00fd13735f7ba901b806f56f/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/strategies/OverTypeStrategy.java#L48
It expects:
1. time attribute at the second position
2. range arguments at 3 and 4
3. optional 5th argument containing partitioning key
4. a function as the first argument
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]