pvary commented on code in PR #14297:
URL: https://github.com/apache/iceberg/pull/14297#discussion_r2981979237
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkFileWriterFactory.java:
##########
@@ -229,6 +251,71 @@ public PositionDeleteWriter<InternalRow>
newPositionDeleteWriter(
}
}
+ @Override
+ public DataWriter<InternalRow> newDataWriter(
+ EncryptedOutputFile file, PartitionSpec spec, StructLike partition) {
+ if (!shouldUseVariantShredding()) {
+ return super.newDataWriter(file, spec, partition);
+ }
+
+ int bufferSize =
+ Integer.parseInt(
+ writeProperties.getOrDefault(
+ SparkSQLProperties.VARIANT_INFERENCE_BUFFER_SIZE,
+
String.valueOf(SparkSQLProperties.VARIANT_INFERENCE_BUFFER_SIZE_DEFAULT)));
+
+ Map<String, String> tableProperties = table != null ? table.properties() :
ImmutableMap.of();
+ MetricsConfig metricsConfig =
+ table != null ? MetricsConfig.forTable(table) :
MetricsConfig.getDefault();
+
+ Function<List<InternalRow>, FileAppender<InternalRow>> appenderFactory =
+ bufferedRows -> {
+ Preconditions.checkNotNull(bufferedRows, "bufferedRows must not be
null");
+ MessageType originalSchema = ParquetSchemaUtil.convert(dataSchema,
"table");
Review Comment:
This is not the place for things like this.
There should not be any FileFormat related thing here.
ParquetFormatModel should contain this logic as this is parquet specific.
If there are Spark specific parts, that should be a method used to
parametrize the ParquetFormatModel, like the WriterBuilderFunction
--
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]