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 2020/04/26 14:11:09 UTC

[GitHub] [incubator-iceberg] chenjunjiedada opened a new pull request #971: Add reader for position based delete file

chenjunjiedada opened a new pull request #971:
URL: https://github.com/apache/incubator-iceberg/pull/971


   


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

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] [incubator-iceberg] chenjunjiedada commented on pull request #971: Add reader for position based delete file

Posted by GitBox <gi...@apache.org>.
chenjunjiedada commented on pull request #971:
URL: https://github.com/apache/incubator-iceberg/pull/971#issuecomment-620672915


   Thanks for reviewing, @rdblue! I will start to address them tomorrow.


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

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] [incubator-iceberg] rdblue commented on a change in pull request #971: Add reader for position based delete file

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



##########
File path: spark/src/main/java/org/apache/iceberg/spark/source/DeleteRecordReader.java
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.spark.source;
+
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.avro.Avro;
+import org.apache.iceberg.encryption.EncryptedFiles;
+import org.apache.iceberg.encryption.EncryptionManager;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.orc.ORC;
+import org.apache.iceberg.parquet.Parquet;
+import org.apache.iceberg.spark.data.SparkAvroReader;
+import org.apache.iceberg.spark.data.SparkOrcReader;
+import org.apache.iceberg.spark.data.SparkParquetReaders;
+import org.apache.spark.sql.catalyst.InternalRow;
+
+public class DeleteRecordReader {
+  private final DataFile file;
+  private final Schema schema;
+  private final EncryptionManager encryptionManager;
+  private final FileIO io;
+
+  public DeleteRecordReader(FileIO io, DataFile file, EncryptionManager encryptionManager, Schema schema) {

Review comment:
       I think this should accept an `InputFile` instead of `io`, `file`, and `encryptionManager`. That allows us to use the bulk API for decryption. Also, the schema can probably be static somewhere because we don't expect it to change and won't be projecting fields.




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

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] [incubator-iceberg] rdblue commented on a change in pull request #971: Add reader for position based delete file

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



##########
File path: core/src/main/java/org/apache/iceberg/PositionBasedDeleteRecord.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.types.Types;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class PositionBasedDeleteRecord implements IndexedRecord, SpecificData.SchemaConstructable {
+
+  private transient org.apache.avro.Schema avroSchema = null;
+  private String filePath = null;
+  private Long position = null;
+
+  /**
+   * Used by Avro reflection to instantiate this class when reading manifest files.
+   */
+  @SuppressWarnings("checkstyle:RedundantModifier") // Must be public
+  public PositionBasedDeleteRecord(org.apache.avro.Schema avroSchema) {
+    this.avroSchema = avroSchema;
+  }
+
+  static org.apache.iceberg.Schema schema() {

Review comment:
       Can you move this static method above the constructor? We don't usually mix them.




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

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] [incubator-iceberg] chenjunjiedada commented on a change in pull request #971: Add reader for position based delete file

Posted by GitBox <gi...@apache.org>.
chenjunjiedada commented on a change in pull request #971:
URL: https://github.com/apache/incubator-iceberg/pull/971#discussion_r427766654



##########
File path: spark/src/main/java/org/apache/iceberg/spark/source/DeleteRecordReader.java
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.spark.source;
+
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.avro.Avro;
+import org.apache.iceberg.encryption.EncryptedFiles;
+import org.apache.iceberg.encryption.EncryptionManager;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.orc.ORC;
+import org.apache.iceberg.parquet.Parquet;
+import org.apache.iceberg.spark.data.SparkAvroReader;
+import org.apache.iceberg.spark.data.SparkOrcReader;
+import org.apache.iceberg.spark.data.SparkParquetReaders;
+import org.apache.spark.sql.catalyst.InternalRow;
+
+public class DeleteRecordReader {
+  private final DataFile file;
+  private final Schema schema;
+  private final EncryptionManager encryptionManager;
+  private final FileIO io;
+
+  public DeleteRecordReader(FileIO io, DataFile file, EncryptionManager encryptionManager, Schema schema) {

Review comment:
       Make sense to me, updated.




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

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] [incubator-iceberg] chenjunjiedada commented on a change in pull request #971: Add reader for position based delete file

Posted by GitBox <gi...@apache.org>.
chenjunjiedada commented on a change in pull request #971:
URL: https://github.com/apache/incubator-iceberg/pull/971#discussion_r427769383



##########
File path: core/src/main/java/org/apache/iceberg/PositionBasedDeleteRecord.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.types.Types;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class PositionBasedDeleteRecord implements IndexedRecord, SpecificData.SchemaConstructable {

Review comment:
       >  If we want to remove the Avro reader and use purely Iceberg to construct the records, we can make that change if we use an interface.
   
   I don't quite follow this. Could you please help to elaborate? 




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

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] [incubator-iceberg] chenjunjiedada commented on a change in pull request #971: Add reader for position based delete file

Posted by GitBox <gi...@apache.org>.
chenjunjiedada commented on a change in pull request #971:
URL: https://github.com/apache/incubator-iceberg/pull/971#discussion_r427765970



##########
File path: core/src/main/java/org/apache/iceberg/PositionBasedDeleteRecord.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.types.Types;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class PositionBasedDeleteRecord implements IndexedRecord, SpecificData.SchemaConstructable {
+
+  private transient org.apache.avro.Schema avroSchema = null;
+  private String filePath = null;
+  private Long position = null;
+
+  /**
+   * Used by Avro reflection to instantiate this class when reading manifest files.
+   */
+  @SuppressWarnings("checkstyle:RedundantModifier") // Must be public

Review comment:
       Done. It passed the test.

##########
File path: core/src/main/java/org/apache/iceberg/PositionBasedDeleteRecord.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.types.Types;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class PositionBasedDeleteRecord implements IndexedRecord, SpecificData.SchemaConstructable {
+
+  private transient org.apache.avro.Schema avroSchema = null;
+  private String filePath = null;
+  private Long position = null;
+
+  /**
+   * Used by Avro reflection to instantiate this class when reading manifest files.
+   */
+  @SuppressWarnings("checkstyle:RedundantModifier") // Must be public
+  public PositionBasedDeleteRecord(org.apache.avro.Schema avroSchema) {
+    this.avroSchema = avroSchema;
+  }
+
+  static org.apache.iceberg.Schema schema() {

Review comment:
       Done.




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

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] [incubator-iceberg] rdblue commented on a change in pull request #971: Add reader for position based delete file

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



##########
File path: core/src/main/java/org/apache/iceberg/PositionBasedDeleteRecord.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.types.Types;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class PositionBasedDeleteRecord implements IndexedRecord, SpecificData.SchemaConstructable {

Review comment:
       This looks mostly good to me, but I don't think that it needs to be public. For the others, we use a public interface and a package-private implementation. That way, we can provide readers and writers, but we don't have to maintain all of the interfaces that we use, like `IndexedRecord` here. If we want to remove the Avro reader and use purely Iceberg to construct the records, we can make that change if we use an interface.




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

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] [incubator-iceberg] rdblue commented on a change in pull request #971: Add reader for position based delete file

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



##########
File path: core/src/main/java/org/apache/iceberg/PositionBasedDeleteRecord.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.types.Types;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class PositionBasedDeleteRecord implements IndexedRecord, SpecificData.SchemaConstructable {
+
+  private transient org.apache.avro.Schema avroSchema = null;
+  private String filePath = null;
+  private Long position = null;
+
+  /**
+   * Used by Avro reflection to instantiate this class when reading manifest files.
+   */
+  @SuppressWarnings("checkstyle:RedundantModifier") // Must be public

Review comment:
       I don't think this is actually required now that we use our own Avro record materialization. Can you try it out as package-private to see if the tests pass?




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

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