nssalian commented on code in PR #14297:
URL: https://github.com/apache/iceberg/pull/14297#discussion_r3106011283
##########
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:
hasVariantColumns checks the schema declaration. This check is different
since the analyzer can return empty if all buffered values are null or below
`MIN_FIELD_FREQUENCY`. Without it we'd set a no-op shredding func.
--
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]