This is an automated email from the ASF dual-hosted git repository.

deniskuzZ pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d0bf698178 HIVE-29797: Use Iceberg 1.11.0 public variantShreddingFunc 
instead of reflection (#6669)
1d0bf698178 is described below

commit 1d0bf6981788fe2e7de44aaf44cce84c2f7a964e
Author: kokila-19 <[email protected]>
AuthorDate: Tue Aug 11 14:19:14 2026 +0530

    HIVE-29797: Use Iceberg 1.11.0 public variantShreddingFunc instead of 
reflection (#6669)
---
 .../mr/hive/writer/HiveFileWriterFactory.java      | 27 +---------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/HiveFileWriterFactory.java
 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/HiveFileWriterFactory.java
index 234cf928432..8923d825159 100644
--- 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/HiveFileWriterFactory.java
+++ 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/HiveFileWriterFactory.java
@@ -32,7 +32,6 @@
 import org.apache.iceberg.data.parquet.GenericParquetWriter;
 import org.apache.iceberg.orc.ORC;
 import org.apache.iceberg.parquet.Parquet;
-import org.apache.iceberg.parquet.VariantShreddingFunction;
 import org.apache.iceberg.parquet.VariantUtil;
 
 class HiveFileWriterFactory extends BaseFileWriterFactory<Record> {
@@ -87,31 +86,7 @@ protected void configureDataWrite(Parquet.DataWriteBuilder 
builder) {
     builder.createWriterFunc(GenericParquetWriter::create);
     // Configure variant shredding if enabled and a sample record is available
     if (VariantUtil.shouldUseVariantShredding(properties, dataSchema())) {
-      setVariantShreddingFunc(builder, 
VariantUtil.variantShreddingFunc(sampleRecord, dataSchema()));
-    }
-  }
-
-  /**
-   * Sets a {@link VariantShreddingFunction} on the underlying Parquet write 
builder.
-   *
-   * <p>{@link Parquet.DataWriteBuilder} does not expose {@code 
variantShreddingFunc} directly; it is set on an
-   * internal write builder held in the private {@code appenderBuilder} field. 
This method uses reflection to
-   * access that internal builder and invoke {@code 
variantShreddingFunc(VariantShreddingFunction)}.
-   *
-   * TODO: Replace with {@code 
DataWriteBuilder.variantShreddingFunc(VariantShreddingFunction)}
-   * once it becomes publicly available.
-   */
-  private static void setVariantShreddingFunc(Parquet.DataWriteBuilder 
dataWriteBuilder,
-      VariantShreddingFunction fn) {
-    try {
-      java.lang.reflect.Field field = 
dataWriteBuilder.getClass().getDeclaredField("appenderBuilder");
-      field.setAccessible(true);
-      Object writeBuilder = field.get(dataWriteBuilder);
-      writeBuilder.getClass()
-          .getMethod("variantShreddingFunc", VariantShreddingFunction.class)
-          .invoke(writeBuilder, fn);
-    } catch (ReflectiveOperationException e) {
-      throw new RuntimeException(e);
+      
builder.variantShreddingFunc(VariantUtil.variantShreddingFunc(sampleRecord, 
dataSchema()));
     }
   }
 

Reply via email to