snuyanzin commented on code in PR #29070:
URL: https://github.com/apache/flink/pull/29070#discussion_r3926023607
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/QueryOperationConverter.java:
##########
@@ -593,6 +608,59 @@ else if (other instanceof DataStreamQueryOperation) {
throw new TableException("Unknown table operation: " + other);
}
+ private RelNode
convertWindowTableFunction(WindowTableFunctionQueryOperation windowOp) {
+ final RexBuilder rexBuilder = relBuilder.getRexBuilder();
+
+ final RelNode input = relBuilder.build();
+ final RelDataType inputRowType = input.getRowType();
+
+ final String timeColumn = windowOp.getTimeColumn();
+ final RelDataType timeAttributeType =
+ inputRowType.getField(timeColumn, false, false).getType();
+ final RelDataType outputRowType =
+ SqlWindowTableFunction.inferRowType(
+ relBuilder.getTypeFactory(), inputRowType,
timeAttributeType);
+
+ final SqlFunction operator =
windowOperator(windowOp.getWindowKind());
+ final List<RexNode> operands = new ArrayList<>();
+ operands.add(
+ new RexTableArgCall(inputRowType, 0, new int[0], new
int[0], new SortOrder[0]));
+ operands.add(
+ rexBuilder.makeCall(
+ FlinkSqlOperatorTable.DESCRIPTOR,
rexBuilder.makeLiteral(timeColumn)));
+ for (Duration interval : windowOp.getIntervals()) {
+ operands.add(
+ rexBuilder.makeIntervalLiteral(
+ BigDecimal.valueOf(interval.toMillis()),
+ new SqlIntervalQualifier(
+ TimeUnit.MILLISECOND, null,
SqlParserPos.ZERO)));
+ }
+
+ final RexNode call = rexBuilder.makeCall(outputRowType, operator,
operands);
+ return LogicalTableFunctionScan.create(
+ relBuilder.getCluster(),
+ new ArrayList<>(Collections.singletonList(input)),
+ call,
+ null,
+ outputRowType,
+ Collections.emptySet());
Review Comment:
```suggestion
Set.of());
```
--
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]