Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Nov 28, 2023
1 parent 9fd776a commit a9950e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,14 @@ public THIS columnOrder(ColumnOrder columnOrder) {

@Override
protected PrimitiveType build(String name) {
// if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitiveType) {
// Preconditions.checkArgument(length > 0,
// "Invalid FIXED_LEN_BYTE_ARRAY length: %s", length);
// }
if (length == 0 && logicalTypeAnnotation instanceof LogicalTypeAnnotation.UUIDLogicalTypeAnnotation) {
length = LogicalTypeAnnotation.UUIDLogicalTypeAnnotation.BYTES;
}

if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitiveType) {
Preconditions.checkArgument(length > 0,
"Invalid FIXED_LEN_BYTE_ARRAY length: %s", length);
}

DecimalMetadata meta = decimalMetadata();

Expand Down Expand Up @@ -554,7 +558,7 @@ public Optional<Boolean> visit(LogicalTypeAnnotation.EnumLogicalTypeAnnotation e

private Optional<Boolean> checkFixedPrimitiveType(int l, LogicalTypeAnnotation logicalTypeAnnotation) {
Preconditions.checkState(
primitiveType == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY,// && length == l,
primitiveType == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY && length == l,
"%s can only annotate FIXED_LEN_BYTE_ARRAY(%s)", logicalTypeAnnotation, l);
return Optional.of(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,18 @@ private static ThriftField toThriftField(String name, Field field, ThriftField.R
final Field listElemField = field.getListElemField();
type = new ThriftType.ListType(toThriftField(listElemField.getName(), listElemField, requirement));
break;
case UUID:
case ENUM:
Collection<TEnum> enumValues = field.getEnumValues();
List<EnumValue> values = new ArrayList<ThriftType.EnumValue>();
for (TEnum tEnum : enumValues) {
values.add(new EnumValue(tEnum.getValue(), tEnum.toString()));
if (field.isEnum()) {
Collection<TEnum> enumValues = field.getEnumValues();
List<EnumValue> values = new ArrayList<ThriftType.EnumValue>();
for (TEnum tEnum : enumValues) {
values.add(new EnumValue(tEnum.getValue(), tEnum.toString()));
}
type = new EnumType(values);
} else {
type = new UUIDType();
}
type = new EnumType(values);
break;
case UUID:
type = new UUIDType();
break;
}
return new ThriftField(name, field.getId(), requirement, type);
Expand Down

0 comments on commit a9950e7

Please sign in to comment.