aokolnychyi commented on code in PR #7703:
URL: https://github.com/apache/iceberg/pull/7703#discussion_r1206961368
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java:
##########
@@ -389,10 +391,44 @@ protected Map<Integer, StructProjection>
buildPartitionProjections(
return partitionProjections;
}
+
+ // use the fanout writer only if enabled and the input is unordered
+ protected PartitioningWriter<InternalRow, DataWriteResult> newDataWriter(
+ Table table, SparkFileWriterFactory writers, OutputFileFactory files,
Context context) {
+
+ FileIO io = table.io();
+ boolean fanoutEnabled = context.fanoutWriterEnabled();
+ boolean inputOrdered = context.inputOrdered();
+ long targetFileSize = context.targetDataFileSize();
+
+ if (fanoutEnabled && !inputOrdered) {
+ return new FanoutDataWriter<>(writers, files, io, targetFileSize);
+ } else {
+ return new ClusteredDataWriter<>(writers, files, io, targetFileSize);
+ }
+ }
+
+ // the spec requires position deletes to be ordered by file and position
+ // use a fanout writer if the input is unordered no matter whether fanout
writers are enabled
+ // clustered writers only validate records for the same spec/paritition
are co-located,
Review Comment:
Updated.
--
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]