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/04 22:30:46 UTC

[GitHub] [iceberg] szehon-ho opened a new pull request, #4694: Core: Add all_delete_files and all_files tables

szehon-ho opened a new pull request, #4694:
URL: https://github.com/apache/iceberg/pull/4694

   This will be the final set of changes for https://github.com/apache/iceberg/issues/4139, adding the new metadata tables 'all_delete_files' and 'all_files' to include delete files.
   
   This adds both in one change list as it's easier to write a unified test, although they can be split up if we prefer that.


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


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

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#discussion_r866347602


##########
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:
   Hm, I'm actually not sure about if its redundant ( 'table' needs an article, right?).  How about:
   ``` A table implementation that exposes its valid delete files as rows```



##########
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:
   Hm, I'm not sure about if its redundant ( 'table' needs an article, right?).  How about:
   ``` A table implementation that exposes its valid delete files as rows```



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


[GitHub] [iceberg] szehon-ho commented on pull request #4694: Core: Add all_delete_files and all_files tables

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#issuecomment-1120014926

   Thanks @aokolnychyi and @kbendick for review


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


[GitHub] [iceberg] szehon-ho commented on pull request #4694: Core: Add all_delete_files and all_files tables

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#issuecomment-1118014391

   FYI @RussellSpitzer @aokolnychyi if you guys have some cycles, thanks


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


[GitHub] [iceberg] szehon-ho merged pull request #4694: Core: Add all_delete_files and all_files tables

Posted by GitBox <gi...@apache.org>.
szehon-ho merged PR #4694:
URL: https://github.com/apache/iceberg/pull/4694


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


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

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#issuecomment-1118760083

   Let me take a look at this one as well.


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


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

Posted by GitBox <gi...@apache.org>.
kbendick commented on code in PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#discussion_r865524316


##########
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:
   Nit: This might read better as `isAllFilesTable`, though I recognize there is an `AllFilesTable` now.
   
   Maybe `isOneOfAllFilesType` or `isTableAggregatedFromAllSnapshots`?
   
   Given there will be an `ALL_FILES` table, I'm not sure of the best name to add for this but throwing those out there.



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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on code in PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#discussion_r866348017


##########
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:
   Ah good catch ..



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


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

Posted by GitBox <gi...@apache.org>.
kbendick commented on code in PR #4694:
URL: https://github.com/apache/iceberg/pull/4694#discussion_r865523486


##########
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:
   Nit: Consider making this a `static final` 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