xuyangzhong commented on code in PR #24162:
URL: https://github.com/apache/flink/pull/24162#discussion_r1466223510
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/tvf/operator/WindowTableFunctionOperatorBase.java:
##########
@@ -91,28 +83,24 @@ public void open() throws Exception {
}
@Override
- public void processElement(StreamRecord<RowData> element) throws Exception
{
- RowData inputRow = element.getValue();
- long timestamp;
- if (windowAssigner.isEventTime()) {
- if (inputRow.isNullAt(rowtimeIndex)) {
- // null timestamp would be dropped
- return;
- }
- timestamp = inputRow.getTimestamp(rowtimeIndex,
3).getMillisecond();
- } else {
- timestamp = getProcessingTimeService().getCurrentProcessingTime();
+ public void close() throws Exception {
+ super.close();
+ if (collector != null) {
+ collector.close();
}
- timestamp = toUtcTimestampMills(timestamp, shiftTimeZone);
- Collection<TimeWindow> elementWindows =
windowAssigner.assignWindows(inputRow, timestamp);
- for (TimeWindow window : elementWindows) {
+ }
+
+ protected void collect(RowData inputRow, Collection<TimeWindow>
allWindows) {
+ for (TimeWindow window : allWindows) {
windowProperties.setField(0,
TimestampData.fromEpochMillis(window.getStart()));
windowProperties.setField(1,
TimestampData.fromEpochMillis(window.getEnd()));
windowProperties.setField(
2,
TimestampData.fromEpochMillis(
toEpochMills(window.maxTimestamp(),
shiftTimeZone)));
- collector.collect(outRow.replace(inputRow, windowProperties));
+ outRow.replace(inputRow, windowProperties);
+ outRow.setRowKind(inputRow.getRowKind());
Review Comment:
Because if not, the RowKind of the output data is always INSERT.
--
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]