beyond1920 commented on a change in pull request #8261: [FLINK-12307][table-planner-blink] Support translation from StreamExecWindowJoin to StreamTransformation. URL: https://github.com/apache/flink/pull/8261#discussion_r279183316
########## File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/join/EmitAwareCollector.java ########## @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.runtime.join; + +import org.apache.flink.table.dataformat.BaseRow; +import org.apache.flink.util.Collector; + +/** + * Collector to wrap a [[org.apache.flink.table.dataformat.BaseRow]] and to track whether a row has been + * emitted by the inner collector. + */ +class EmitAwareCollector implements Collector<BaseRow> { + + static final byte JOINED = 1; + static final byte NONJOINED = 0; + + private boolean emitted = false; + private Collector<BaseRow> innerCollector; + + void reset() { + emitted = false; + } + + boolean isEmitted() { + return emitted; + } + + void setInnerCollector(Collector<BaseRow> innerCollector) { + this.innerCollector = innerCollector; + } + + @Override + public void collect(BaseRow record) { + emitted = true; + innerCollector.collect(record); + } + + @Override + public void close() { + innerCollector.close(); + } + + static boolean isJoined(BaseRow baseRow) { + return baseRow.getHeader() == JOINED; Review comment: Yes, the method is a little tricky. I update the state from MapState<Long, List<BaseRow>> to MapState<Long, List<Tuple2<BaseRow, Boolean>>>. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
