Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Thanks Aihua
  • Loading branch information
Fokko committed Sep 3, 2025
commit d6edcb1cde6be4be294d5f8005d78944f24f9f68
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public static <T> T visit(
return visitList(iType, group, visitor);
} else if (annotation instanceof MapLogicalTypeAnnotation) {
return visitMap(iType, group, visitor);
} else if (iType != null && iType.isVariantType()) {
} else if (annotation instanceof LogicalTypeAnnotation.VariantLogicalTypeAnnotation
|| (iType != null && iType.isVariantType())) {
// when Parquet has a VARIANT logical type, use it here
return visitVariant(iType.asVariantType(), group, visitor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ public static <T> T visit(DataType sType, Type type, ParquetWithSparkSchemaVisit
} finally {
visitor.fieldNames.pop();
}
} else if (sType instanceof VariantType
|| LogicalTypeAnnotation.variantType(Variant.VARIANT_SPEC_VERSION).equals(annotation)) {
} else if (LogicalTypeAnnotation.variantType(Variant.VARIANT_SPEC_VERSION).equals(annotation)
|| sType instanceof VariantType) {
// For the Variant we both check the Parquet LogicalTypeAnnotation, and we rely on the
// Iceberg schema, since there are engines like Spark that produce VariantTypes without the
// annotation.
Preconditions.checkArgument(
sType instanceof VariantType,
"Invalid variant: Spark type %s is not a variant type",
Expand Down