pvary commented on code in PR #14297:
URL: https://github.com/apache/iceberg/pull/14297#discussion_r3093511334


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetFormatModel.java:
##########
@@ -217,6 +258,39 @@ public FileAppender<D> build() throws IOException {
 
       return internal.build();
     }
+
+    /**
+     * Creates a {@link BufferedFileAppender} that buffers the first N rows, 
runs variant shredding
+     * analysis on them, then creates the real Parquet appender with a 
shredded schema.
+     *
+     * <p>Only top-level variant columns are shredded. Nested variants (inside 
structs/lists/maps)
+     * fall through to unshredded 2-field layout because column index 
resolution only applies to
+     * top-level fields.
+     */
+    private FileAppender<D> buildShreddedAppender() {
+      return new BufferedFileAppender<>(
+          bufferSize,
+          bufferedRows -> {
+            Map<Integer, Type> shreddedTypes =
+                variantAnalyzer.analyzeVariantColumns(bufferedRows, schema, 
engineSchema);
+
+            if (!shreddedTypes.isEmpty()) {

Review Comment:
   Do we need this check? We already know that `hasVariantColumns`



##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetFormatModel.java:
##########
@@ -217,6 +258,39 @@ public FileAppender<D> build() throws IOException {
 
       return internal.build();
     }
+
+    /**
+     * Creates a {@link BufferedFileAppender} that buffers the first N rows, 
runs variant shredding
+     * analysis on them, then creates the real Parquet appender with a 
shredded schema.
+     *
+     * <p>Only top-level variant columns are shredded. Nested variants (inside 
structs/lists/maps)
+     * fall through to unshredded 2-field layout because column index 
resolution only applies to
+     * top-level fields.
+     */
+    private FileAppender<D> buildShreddedAppender() {
+      return new BufferedFileAppender<>(
+          bufferSize,
+          bufferedRows -> {
+            Map<Integer, Type> shreddedTypes =
+                variantAnalyzer.analyzeVariantColumns(bufferedRows, schema, 
engineSchema);
+
+            if (!shreddedTypes.isEmpty()) {

Review Comment:
   Do we need this check? We already know that `hasVariantColumns` is true



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