rdblue commented on PR #2639:
URL: https://github.com/apache/iceberg/pull/2639#issuecomment-1465015904

   @ggershinsky, this is looking good, but there are a few minor updates needed 
and it requires more testing to exercise more of the Iceberg specific code. You 
can check out code coverage to see when you're hitting all the areas you've 
changed.
   
   Also, for the change to remove reflection, here's a diff since I explored 
that locally:
   
   ```diff
   [blue@work iceberg]$ git diff
   diff --git 
a/parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java 
b/parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java
   index af2fb0e80a..ee3a8f50be 100644
   --- a/parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java
   +++ b/parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java
   @@ -28,20 +28,16 @@ import org.apache.hadoop.conf.Configuration;
    import org.apache.iceberg.Metrics;
    import org.apache.iceberg.MetricsConfig;
    import org.apache.iceberg.Schema;
   -import org.apache.iceberg.common.DynConstructors;
   -import org.apache.iceberg.common.DynMethods;
    import org.apache.iceberg.io.FileAppender;
    import org.apache.iceberg.io.OutputFile;
    import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
    import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
   -import org.apache.parquet.bytes.ByteBufferAllocator;
    import org.apache.parquet.column.ColumnWriteStore;
    import org.apache.parquet.column.ParquetProperties;
   -import org.apache.parquet.column.page.PageWriteStore;
   -import org.apache.parquet.column.values.bloomfilter.BloomFilterWriteStore;
    import org.apache.parquet.crypto.FileEncryptionProperties;
    import org.apache.parquet.crypto.InternalFileEncryptor;
    import org.apache.parquet.hadoop.CodecFactory;
   +import org.apache.parquet.hadoop.ColumnChunkPageWriteStore;
    import org.apache.parquet.hadoop.ParquetFileWriter;
    import org.apache.parquet.hadoop.metadata.CompressionCodecName;
    import org.apache.parquet.schema.MessageType;
   @@ -50,25 +46,6 @@ class ParquetWriter<T> implements FileAppender<T>, 
Closeable {
    
      private static final Metrics EMPTY_METRICS = new Metrics(0L, null, null, 
null, null);
    
   -  private static final DynConstructors.Ctor<PageWriteStore> 
pageStoreCtorParquet =
   -      DynConstructors.builder(PageWriteStore.class)
   -          .hiddenImpl(
   -              "org.apache.parquet.hadoop.ColumnChunkPageWriteStore",
   -              CodecFactory.BytesCompressor.class,
   -              MessageType.class,
   -              ByteBufferAllocator.class,
   -              int.class,
   -              boolean.class,
   -              InternalFileEncryptor.class,
   -              int.class)
   -          .build();
   -
   -  private static final DynMethods.UnboundMethod flushToWriter =
   -      DynMethods.builder("flushToFileWriter")
   -          .hiddenImpl(
   -              "org.apache.parquet.hadoop.ColumnChunkPageWriteStore", 
ParquetFileWriter.class)
   -          .build();
   -
      private final long targetRowGroupSize;
      private final Map<String, String> metadata;
      private final ParquetProperties props;
   @@ -81,7 +58,7 @@ class ParquetWriter<T> implements FileAppender<T>, 
Closeable {
      private final OutputFile output;
      private final Configuration conf;
    
   -  private DynMethods.BoundMethod flushPageStoreToWriter;
   +  private ColumnChunkPageWriteStore pageStore = null;
      private ColumnWriteStore writeStore;
      private long recordCount = 0;
      private long nextCheckRecordCount = 10;
   @@ -232,7 +209,7 @@ class ParquetWriter<T> implements FileAppender<T>, 
Closeable {
            ensureWriterInitialized();
            writer.startBlock(recordCount);
            writeStore.flush();
   -        flushPageStoreToWriter.invoke(writer);
   +        pageStore.flushToFileWriter(writer);
            writer.endBlock();
            if (!finished) {
              writeStore.close();
   @@ -253,8 +230,8 @@ class ParquetWriter<T> implements FileAppender<T>, 
Closeable {
                props.getMaxRowCountForPageSizeCheck());
        this.recordCount = 0;
    
   -    PageWriteStore pageStore =
   -        pageStoreCtorParquet.newInstance(
   +    this.pageStore =
   +        new ColumnChunkPageWriteStore(
                compressor,
                parquetSchema,
                props.getAllocator(),
   @@ -264,9 +241,7 @@ class ParquetWriter<T> implements FileAppender<T>, 
Closeable {
                rowGroupOrdinal);
        this.rowGroupOrdinal++;
    
   -    this.flushPageStoreToWriter = flushToWriter.bind(pageStore);
   -    this.writeStore =
   -        props.newColumnWriteStore(parquetSchema, pageStore, 
(BloomFilterWriteStore) pageStore);
   +    this.writeStore = props.newColumnWriteStore(parquetSchema, pageStore, 
pageStore);
    
        model.setColumnStore(writeStore);
      }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to