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/05 20:15:19 UTC

[GitHub] [iceberg] aokolnychyi commented on a diff in pull request #4694: Core: Add all_delete_files and all_files tables

aokolnychyi commented on code in PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#discussion_r866278472


##########
core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java:
##########
@@ -129,14 +137,28 @@ private int expectedScanTaskCount(int partitions) {
         }
       case DATA_FILES:
       case DELETE_FILES:
+      case ALL_DELETE_FILES:
         return partitions;
       case ALL_DATA_FILES:
         return partitions * 2; // ScanTask for Data Manifest in DELETED and ADDED states
+      case ALL_FILES:
+        if (formatVersion == 1) {
+          return partitions * 2; // ScanTask for Data Manifest in DELETED and ADDED states
+        } else {
+          return partitions * 4; // ScanTask for Delete and Data File in DELETED and ADDED states
+        }
       default:
         throw new IllegalArgumentException("Unsupported metadata table type:" + type);
     }
   }
 
+  private boolean allFileTableTest(MetadataTableType tableType) {

Review Comment:
   What about `isAggFileTable`?



##########
core/src/main/java/org/apache/iceberg/AllDeleteFilesTable.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 org.apache.iceberg.io.CloseableIterable;
+
+/**
+ * A {@link Table} implementation that exposes a table's valid delete files as rows.
+ * <p>
+ * A valid delete file is one that is readable from any snapshot currently tracked by the table.
+ * <p>
+ * This table may return duplicate rows.
+ */
+public class AllDeleteFilesTable extends BaseFilesTable {
+
+  AllDeleteFilesTable(TableOperations ops, Table table) {
+    this(ops, table, table.name() + ".all_delete_files");
+  }
+
+  AllDeleteFilesTable(TableOperations ops, Table table, String name) {
+    super(ops, table, name);
+  }
+
+  @Override
+  public TableScan newScan() {
+    return new AllDataFilesTableScan(operations(), table(), schema());
+  }
+
+  @Override
+  MetadataTableType metadataTableType() {
+    return MetadataTableType.ALL_DELETE_FILES;
+  }
+
+  public static class AllDataFilesTableScan extends BaseAllFilesTableScan {

Review Comment:
   Typo: should be `AllDeleteFilesTableScan`



##########
core/src/main/java/org/apache/iceberg/AllDeleteFilesTable.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 org.apache.iceberg.io.CloseableIterable;
+
+/**
+ * A {@link Table} implementation that exposes a table's valid delete files as rows.

Review Comment:
   nit: redundant `a` before `table's valid delete files`?



##########
core/src/main/java/org/apache/iceberg/AllFilesTable.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 org.apache.iceberg.io.CloseableIterable;
+
+/**
+ * A {@link Table} implementation that exposes a table's valid files as rows.

Review Comment:
   nit: also redundant `a`



##########
core/src/main/java/org/apache/iceberg/AllFilesTable.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 org.apache.iceberg.io.CloseableIterable;
+
+/**
+ * A {@link Table} implementation that exposes a table's valid files as rows.
+ * <p>
+ * A valid file is one that is readable from any snapshot currently tracked by the table.
+ * <p>
+ * This table may return duplicate rows.
+ */
+public class AllFilesTable extends BaseFilesTable {
+
+  AllFilesTable(TableOperations ops, Table table) {
+    this(ops, table, table.name() + ".all_files");
+  }
+
+  AllFilesTable(TableOperations ops, Table table, String name) {
+    super(ops, table, name);
+  }
+
+  @Override
+  public TableScan newScan() {
+    return new AllDataFilesTableScan(operations(), table(), schema());
+  }
+
+  @Override
+  MetadataTableType metadataTableType() {
+    return MetadataTableType.ALL_FILES;
+  }
+
+  public static class AllDataFilesTableScan extends BaseAllFilesTableScan {

Review Comment:
   Typo in the name as well.



##########
core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java:
##########
@@ -129,14 +137,28 @@ private int expectedScanTaskCount(int partitions) {
         }
       case DATA_FILES:
       case DELETE_FILES:
+      case ALL_DELETE_FILES:
         return partitions;
       case ALL_DATA_FILES:
         return partitions * 2; // ScanTask for Data Manifest in DELETED and ADDED states
+      case ALL_FILES:
+        if (formatVersion == 1) {
+          return partitions * 2; // ScanTask for Data Manifest in DELETED and ADDED states
+        } else {
+          return partitions * 4; // ScanTask for Delete and Data File in DELETED and ADDED states
+        }
       default:
         throw new IllegalArgumentException("Unsupported metadata table type:" + type);
     }
   }
 
+  private boolean allFileTableTest(MetadataTableType tableType) {
+    return Sets.newHashSet(MetadataTableType.ALL_DATA_FILES,
+            MetadataTableType.ALL_DATA_FILES,
+            MetadataTableType.ALL_FILES)

Review Comment:
   +1 for a constant



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