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 2021/09/18 22:14:30 UTC

[GitHub] [iceberg] aokolnychyi opened a new pull request #3149: Core: Add FileWriter interface

aokolnychyi opened a new pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149


   This PR adds the `FileWriter` interface that defines a contract for writing a number of files of a single type within one spec/partition.


-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711648058



##########
File path: core/src/main/java/org/apache/iceberg/io/FileWriterFactory.java
##########
@@ -28,7 +28,7 @@
 /**
  * A factory for creating data and delete writers.
  */
-public interface WriterFactory<T> {
+public interface FileWriterFactory<T> {

Review comment:
       This API was added recently and we haven't consumed it yet anywhere.




-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711678873



##########
File path: core/src/main/java/org/apache/iceberg/deletes/PositionDeleteWriter.java
##########
@@ -52,18 +53,30 @@ public PositionDeleteWriter(FileAppender<StructLike> appender, FileFormat format
     this.partition = partition;
     this.keyMetadata = keyMetadata != null ? keyMetadata.buffer() : null;
     this.delete = PositionDelete.create();
-    this.pathSet = CharSequenceSet.empty();
+    this.referencedDataFiles = CharSequenceSet.empty();

Review comment:
       @openinx @rdblue, it is the rename we discussed [here](https://github.com/apache/iceberg/pull/2945/files#r696236311).




-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711648058



##########
File path: core/src/main/java/org/apache/iceberg/io/FileWriterFactory.java
##########
@@ -28,7 +28,7 @@
 /**
  * A factory for creating data and delete writers.
  */
-public interface WriterFactory<T> {
+public interface FileWriterFactory<T> {

Review comment:
       This API was added recently and we haven't consumed it anywhere yet.




-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711795301



##########
File path: core/src/main/java/org/apache/iceberg/io/DataWriter.java
##########
@@ -57,6 +56,12 @@ public DataWriter(FileAppender<T> appender, FileFormat format, String location,
     this.sortOrder = sortOrder;
   }
 
+  @Override
+  public void write(T row) {
+    appender.add(row);
+  }
+
+  @Deprecated

Review comment:
       Added.




-- 
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] rdblue commented on a change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711791493



##########
File path: core/src/main/java/org/apache/iceberg/io/EqualityDeleteWriteResult.java
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.io;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.iceberg.DeleteFile;
+
+/**
+ * A result of writing equality delete files.
+ * <p>
+ * Note that objects of this class are NOT meant to be serialized. Task or delta writers will wrap
+ * these results into their own serializable results that can be sent back to query engines.
+ */
+public class EqualityDeleteWriteResult {

Review comment:
       Do we need a special class for this that doesn't have referenced data files? Seems like we could just use the same result for equality and position deletes.




-- 
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 #3149: Core: Add FileWriter interface

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


   cc @openinx @stevenzwu @RussellSpitzer @rdblue @kbendick @karuppayya @flyrain @pvary @jackye1995 @yyanyy @szehon-ho @rymurr @jun-he
   
   This PR contains a subset of changes in PR #2945.


-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711793901



##########
File path: core/src/main/java/org/apache/iceberg/io/EqualityDeleteWriteResult.java
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.io;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.iceberg.DeleteFile;
+
+/**
+ * A result of writing equality delete files.
+ * <p>
+ * Note that objects of this class are NOT meant to be serialized. Task or delta writers will wrap
+ * these results into their own serializable results that can be sent back to query engines.
+ */
+public class EqualityDeleteWriteResult {

Review comment:
       I think you are right. I am a bit overthinking it. I'll revert.




-- 
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] rdblue commented on a change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711791371



##########
File path: core/src/main/java/org/apache/iceberg/io/DataWriter.java
##########
@@ -57,6 +56,12 @@ public DataWriter(FileAppender<T> appender, FileFormat format, String location,
     this.sortOrder = sortOrder;
   }
 
+  @Override
+  public void write(T row) {
+    appender.add(row);
+  }
+
+  @Deprecated

Review comment:
       When adding `@Deprecated` annotations, we should always include a comment that states when it will be removed. In this case, `0.14.0` or `1.0.0`.




-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711791889



##########
File path: core/src/main/java/org/apache/iceberg/io/EqualityDeleteWriteResult.java
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.io;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.iceberg.DeleteFile;
+
+/**
+ * A result of writing equality delete files.
+ * <p>
+ * Note that objects of this class are NOT meant to be serialized. Task or delta writers will wrap
+ * these results into their own serializable results that can be sent back to query engines.
+ */
+public class EqualityDeleteWriteResult {

Review comment:
       I had that in the original PR but then I had to add validation in `RollingEqualityDeleteWriter` and other classes that the result does not have any data files referenced.
   
   I am 50/50 here. I can revert back.




-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711795415



##########
File path: core/src/main/java/org/apache/iceberg/io/EqualityDeleteWriteResult.java
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.io;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.iceberg.DeleteFile;
+
+/**
+ * A result of writing equality delete files.
+ * <p>
+ * Note that objects of this class are NOT meant to be serialized. Task or delta writers will wrap
+ * these results into their own serializable results that can be sent back to query engines.
+ */
+public class EqualityDeleteWriteResult {

Review comment:
       Reverted.




-- 
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] rdblue commented on pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
rdblue commented on pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#issuecomment-922524566


   Looks good overall. My only complaint is that I doubt we need separate result classes for both position and equality deletes. But that's minor and up to you. Merge when you're ready and tests are passing!


-- 
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 #3149: Core: Add FileWriter interface

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


   Thanks for reviewing, @rdblue!


-- 
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 change in pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149#discussion_r711791889



##########
File path: core/src/main/java/org/apache/iceberg/io/EqualityDeleteWriteResult.java
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.io;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.iceberg.DeleteFile;
+
+/**
+ * A result of writing equality delete files.
+ * <p>
+ * Note that objects of this class are NOT meant to be serialized. Task or delta writers will wrap
+ * these results into their own serializable results that can be sent back to query engines.
+ */
+public class EqualityDeleteWriteResult {

Review comment:
       I had that in the original PR but then I had to add validation in `RollingEqualityDeleteWriter` and other classes that the intermediate result does not have any data files referenced.
   
   I am 50/50 here. I can revert back.




-- 
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 merged pull request #3149: Core: Add FileWriter interface

Posted by GitBox <gi...@apache.org>.
aokolnychyi merged pull request #3149:
URL: https://github.com/apache/iceberg/pull/3149


   


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