You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/13 16:27:30 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #4744: Incremental append scan impl

rdblue commented on code in PR #4744:
URL: https://github.com/apache/iceberg/pull/4744#discussion_r872580847


##########
core/src/main/java/org/apache/iceberg/BaseIncrementalAppendScan.java:
##########
@@ -0,0 +1,247 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Collectors;
+import org.apache.iceberg.events.IncrementalAppendScanEvent;
+import org.apache.iceberg.events.Listeners;
+import org.apache.iceberg.expressions.Expression;
+import org.apache.iceberg.expressions.Expressions;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.FluentIterable;
+import org.apache.iceberg.relocated.com.google.common.collect.Iterables;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.relocated.com.google.common.collect.Sets;
+import org.apache.iceberg.util.PropertyUtil;
+import org.apache.iceberg.util.SnapshotUtil;
+import org.apache.iceberg.util.TableScanUtil;
+
+class BaseIncrementalAppendScan implements IncrementalAppendScan {
+
+  private final TableOperations ops;
+  private final Table table;
+  private TableScanContext context;
+
+  BaseIncrementalAppendScan(TableOperations ops, Table table) {
+    this(ops, table, new TableScanContext());
+  }
+
+  BaseIncrementalAppendScan(TableOperations ops, Table table, TableScanContext context) {
+    this.ops = ops;
+    this.table = table;
+    this.context = context;
+  }
+
+  @Override
+  public IncrementalAppendScan option(String property, String value) {
+    this.context = context.withOption(property, value);
+    return this;
+  }
+
+  @Override
+  public IncrementalAppendScan project(Schema projectedSchema) {
+    this.context = context.project(projectedSchema);
+    return this;

Review Comment:
   The `TableScan` interface is immutable and we should follow the same pattern here by returning a new scan object with the new configuration merged in. The `context` already does this (which is why you have to assign the result to `context`.



-- 
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