Skip to content

Commit

Permalink
Clean up now that core changes from apache#11831 are in.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdblue committed Feb 18, 2025
1 parent b1a2645 commit a6e9a93
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static <R> R visit(GroupType type, ParquetVariantVisitor<R> visitor) {
return visitor.variant(type, metadataResult, valueResult);
}

public static <R> R visitValue(GroupType valueGroup, ParquetVariantVisitor<R> visitor) {
private static <R> R visitValue(GroupType valueGroup, ParquetVariantVisitor<R> visitor) {
R valueResult;
if (ParquetSchemaUtil.hasField(valueGroup, VALUE)) {
Type valueType = valueGroup.getType(VALUE);
Expand Down Expand Up @@ -264,7 +264,7 @@ private static <R> List<R> visitObjectFields(GroupType fields, ParquetVariantVis
}

@FunctionalInterface
interface Action<R> {
private interface Action<R> {
R invoke();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ private Integer getId(Type type) {
}

private boolean isStruct(Type field, NestedField expected) {
if (field.isPrimitive()) {
return false;
} else if (expected.type() == org.apache.iceberg.types.Types.VariantType.get()) {
if (field.isPrimitive() || expected.type().isVariantType()) {
return false;
} else {
GroupType groupType = field.asGroupType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public Type field(NestedField field) {
if (field.type().isPrimitiveType()) {
return primitive(field.type().asPrimitiveType(), repetition, id, name);

} else if (field.type() instanceof org.apache.iceberg.types.Types.VariantType) {
} else if (field.type().isVariantType()) {
return variant(repetition, id, name);

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.iceberg.types.Type.TypeID;
import org.apache.iceberg.types.Types;
import org.apache.parquet.schema.GroupType;
import org.apache.parquet.schema.LogicalTypeAnnotation;
Expand Down Expand Up @@ -62,9 +61,9 @@ 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.typeId() == TypeID.VARIANT) {
} else if (iType != null && iType.isVariantType()) {
// when Parquet has a VARIANT logical type, use it here
return visitVariant((Types.VariantType) iType, group, visitor);
return visitVariant(iType.asVariantType(), group, visitor);
}

Types.StructType struct = iType != null ? iType.asStructType() : null;
Expand Down

0 comments on commit a6e9a93

Please sign in to comment.