You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "pvary (via GitHub)" <gi...@apache.org> on 2023/05/02 05:12:47 UTC

[GitHub] [iceberg] pvary commented on a diff in pull request #7366: Flink: add event time ordered assigner for FLIP-27 source

pvary commented on code in PR #7366:
URL: https://github.com/apache/iceberg/pull/7366#discussion_r1182088120


##########
flink/v1.16/flink/src/main/java/org/apache/iceberg/flink/source/assigner/EventTimeAlignedAssigner.java:
##########
@@ -0,0 +1,301 @@
+/*
+ *
+ *  * 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.iceberg.flink.source.assigner;
+
+import java.io.Serializable;
+import java.time.Duration;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.NotThreadSafe;
+import org.apache.flink.api.common.eventtime.TimestampAssigner;
+import org.apache.iceberg.flink.source.split.IcebergSourceSplit;
+import org.apache.iceberg.flink.source.split.IcebergSourceSplitState;
+import org.apache.iceberg.flink.source.split.IcebergSourceSplitStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.flink.calcite.shaded.com.google.common.collect.Iterables.getFirst;
+
+public class EventTimeAlignedAssigner implements SplitAssigner, WatermarkTracker.Listener {

Review Comment:
   > The minimum of all minimum timestamps of assigned + unassigned splits gives a value that correctly delineates all completed data from all possible future data
   
   I think this is what Flink Watermark aggregation does. Every Operator makes sure that its own watermark is correct in its own scope (increasing monotonously), and Flink aggregates them and keeps track of the lowest value.
   
   With this watermark, the  watermark alignment pauses the reader which are over the alignment limit. In the current Flink implementation the watermark is aggregated and published asynchronously, so the current implementation does not guarantee that we do not read records above the limit, but we do not read too many.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org