pvary commented on code in PR #12298:
URL: https://github.com/apache/iceberg/pull/12298#discussion_r2382714439
##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkFileWriterFactory.java:
##########
@@ -293,4 +217,48 @@ SparkFileWriterFactory build() {
writeProperties);
}
}
+
+ private static StructType calculateSparkTypeForDelete(StructType sparkType,
Schema schema) {
+ if (sparkType != null) {
+ // The delete types need to have the correct metadata columns.
+ if (sparkType.fields().length < 3) {
+ return PATH_POS_TYPE;
+ } else {
+ StructField rowField =
+
sparkType.fields()[sparkType.fieldIndex(MetadataColumns.DELETE_FILE_ROW_FIELD_NAME)];
+ return new StructType(
+ new StructField[] {
+ new StructField(
+ MetadataColumns.DELETE_FILE_PATH.name(),
+ DataTypes.StringType,
+ false,
+ Metadata.empty()),
+ new StructField(
+ MetadataColumns.DELETE_FILE_POS.name(),
+ DataTypes.LongType,
+ false,
+ Metadata.empty()),
+ new StructField(
+ MetadataColumns.DELETE_FILE_ROW_FIELD_NAME,
+ rowField.dataType(),
+ false,
+ Metadata.empty())
+ });
+ }
+ } else if (schema != null) {
+ return SparkSchemaUtil.convert(schema);
+ } else {
+ return null;
+ }
+ }
+
+ private static StructType calculateSparkType(StructType sparkType, Schema
schema) {
+ if (sparkType != null) {
+ return sparkType;
+ } else if (schema != null) {
+ return SparkSchemaUtil.convert(schema);
+ } else {
+ return null;
Review Comment:
That's fair
--
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]