Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,10 @@ private boolean canCast(Type fromType, Type toType)
if (fromType instanceof UnknownType || toType instanceof UnknownType) {
return true;
}
if (fromType instanceof RowType) {
if (toType instanceof RowType) {
List<Type> fromTypeParameters = fromType.getTypeParameters();
List<Type> toTypeParameters = toType.getTypeParameters();
if (fromType instanceof RowType fromRowType) {
if (toType instanceof RowType toRowType) {
List<Type> fromTypeParameters = fromRowType.getFieldTypes();
List<Type> toTypeParameters = toRowType.getFieldTypes();
if (fromTypeParameters.size() != toTypeParameters.size()) {
return false;
}
Expand All @@ -626,9 +626,9 @@ private boolean canCast(Type fromType, Type toType)
}
return false;
}
if (toType instanceof RowType) {
if (toType instanceof RowType toRowType) {
if (isRecursiveCastToRow(fromType)) {
return toType.getTypeParameters().stream()
return toRowType.getFieldTypes().stream()
.allMatch(toTypeParameter -> canCast(fromType, toTypeParameter));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class RowVariantWriter
ImmutableList.Builder<Optional<VariantWriter>> writersInWriteOrder = ImmutableList.builderWithExpectedSize(fieldCount);

for (int fieldIndex : writeOrder) {
Type fieldType = type.getTypeParameters().get(fieldIndex);
Type fieldType = type.getFieldTypes().get(fieldIndex);
fieldNamesInWriteOrder.add(fieldNames.get(fieldIndex));
fieldTypesInWriteOrder.add(fieldType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static boolean canCastToVariant(Type type)
canCastToVariant(mapType.getValueType());
}
if (type instanceof RowType rowType) {
return rowType.getTypeParameters().stream().allMatch(VariantUtil::canCastToVariant);
return rowType.getFieldTypes().stream().allMatch(VariantUtil::canCastToVariant);
}
return false;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ public static boolean canCastFromVariant(Type type)
return mapType.getKeyType() instanceof VarcharType && canCastFromVariant(mapType.getValueType());
}
if (type instanceof RowType rowType) {
return rowType.getTypeParameters().stream().allMatch(VariantUtil::canCastFromVariant);
return rowType.getFieldTypes().stream().allMatch(VariantUtil::canCastFromVariant);
}
return false;
}
Expand Down