rdblue commented on code in PR #15328:
URL: https://github.com/apache/iceberg/pull/15328#discussion_r2819457255
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteTablePathSparkAction.java:
##########
@@ -754,30 +738,37 @@ private static PositionDeleteWriter<Record>
positionDeletesWriter(
StructLike partition,
Schema rowSchema)
throws IOException {
- switch (format) {
- case AVRO:
- return Avro.writeDeletes(outputFile)
- .createWriterFunc(DataWriter::create)
- .withPartition(partition)
- .rowSchema(rowSchema)
- .withSpec(spec)
- .buildPositionWriter();
- case PARQUET:
- return Parquet.writeDeletes(outputFile)
- .createWriterFunc(GenericParquetWriter::create)
- .withPartition(partition)
- .rowSchema(rowSchema)
- .withSpec(spec)
- .buildPositionWriter();
- case ORC:
- return ORC.writeDeletes(outputFile)
- .createWriterFunc(GenericOrcWriter::buildWriter)
- .withPartition(partition)
- .rowSchema(rowSchema)
- .withSpec(spec)
- .buildPositionWriter();
- default:
- throw new UnsupportedOperationException("Unsupported file format: " +
format);
+ if (rowSchema == null) {
+ return FormatModelRegistry.<Record>positionDeleteWriteBuilder(
+ format, EncryptedFiles.plainAsEncryptedOutput(outputFile))
+ .partition(partition)
+ .spec(spec)
+ .build();
+ } else {
+ return switch (format) {
+ case AVRO ->
+ Avro.writeDeletes(outputFile)
+ .createWriterFunc(DataWriter::create)
+ .withPartition(partition)
+ .rowSchema(rowSchema)
Review Comment:
Just to double check: what was the rationale for not plumbing a schema
passed to the registered builder via `schema` in for this purpose? Couldn't we
have the `FileWriterBuilderImpl` return a
`PositionDeleteWriter<PositionDelete<InternalRow>>`?
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteTablePathSparkAction.java:
##########
@@ -754,30 +738,37 @@ private static PositionDeleteWriter<Record>
positionDeletesWriter(
StructLike partition,
Schema rowSchema)
throws IOException {
- switch (format) {
- case AVRO:
- return Avro.writeDeletes(outputFile)
- .createWriterFunc(DataWriter::create)
- .withPartition(partition)
- .rowSchema(rowSchema)
- .withSpec(spec)
- .buildPositionWriter();
- case PARQUET:
- return Parquet.writeDeletes(outputFile)
- .createWriterFunc(GenericParquetWriter::create)
- .withPartition(partition)
- .rowSchema(rowSchema)
- .withSpec(spec)
- .buildPositionWriter();
- case ORC:
- return ORC.writeDeletes(outputFile)
- .createWriterFunc(GenericOrcWriter::buildWriter)
- .withPartition(partition)
- .rowSchema(rowSchema)
- .withSpec(spec)
- .buildPositionWriter();
- default:
- throw new UnsupportedOperationException("Unsupported file format: " +
format);
+ if (rowSchema == null) {
+ return FormatModelRegistry.<Record>positionDeleteWriteBuilder(
+ format, EncryptedFiles.plainAsEncryptedOutput(outputFile))
+ .partition(partition)
+ .spec(spec)
+ .build();
+ } else {
+ return switch (format) {
+ case AVRO ->
+ Avro.writeDeletes(outputFile)
+ .createWriterFunc(DataWriter::create)
+ .withPartition(partition)
+ .rowSchema(rowSchema)
Review Comment:
Just to double check: what was the rationale for not plumbing a schema
passed to the registered builder via `schema` in for this purpose? Couldn't we
have the `FileWriterBuilderImpl` return a
`PositionDeleteWriter<PositionDelete<InternalRow>>`?
--
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]