Java Code Examples for org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName#BOOLEAN
The following examples show how to use
org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName#BOOLEAN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataReader.java From presto with Apache License 2.0 | 6 votes |
private static PrimitiveTypeName getTypeName(Type type) { switch (type) { case BYTE_ARRAY: return PrimitiveTypeName.BINARY; case INT64: return PrimitiveTypeName.INT64; case INT32: return PrimitiveTypeName.INT32; case BOOLEAN: return PrimitiveTypeName.BOOLEAN; case FLOAT: return PrimitiveTypeName.FLOAT; case DOUBLE: return PrimitiveTypeName.DOUBLE; case INT96: return PrimitiveTypeName.INT96; case FIXED_LEN_BYTE_ARRAY: return PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY; default: throw new IllegalArgumentException("Unknown type " + type); } }
Example 2
Source File: ParquetMetadataConverter.java From parquet-mr with Apache License 2.0 | 6 votes |
public PrimitiveTypeName getPrimitive(Type type) { switch (type) { case BYTE_ARRAY: // TODO: rename BINARY and remove this switch return PrimitiveTypeName.BINARY; case INT64: return PrimitiveTypeName.INT64; case INT32: return PrimitiveTypeName.INT32; case BOOLEAN: return PrimitiveTypeName.BOOLEAN; case FLOAT: return PrimitiveTypeName.FLOAT; case DOUBLE: return PrimitiveTypeName.DOUBLE; case INT96: return PrimitiveTypeName.INT96; case FIXED_LEN_BYTE_ARRAY: return PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY; default: throw new RuntimeException("Unknown type " + type); } }
Example 3
Source File: HiveSchemaConverter.java From parquet-mr with Apache License 2.0 | 5 votes |
private static Type convertType(final String name, final TypeInfo typeInfo, final Repetition repetition) { if (typeInfo.getCategory().equals(Category.PRIMITIVE)) { if (typeInfo.equals(TypeInfoFactory.stringTypeInfo)) { return new PrimitiveType(repetition, PrimitiveTypeName.BINARY, name); } else if (typeInfo.equals(TypeInfoFactory.intTypeInfo) || typeInfo.equals(TypeInfoFactory.shortTypeInfo) || typeInfo.equals(TypeInfoFactory.byteTypeInfo)) { return new PrimitiveType(repetition, PrimitiveTypeName.INT32, name); } else if (typeInfo.equals(TypeInfoFactory.longTypeInfo)) { return new PrimitiveType(repetition, PrimitiveTypeName.INT64, name); } else if (typeInfo.equals(TypeInfoFactory.doubleTypeInfo)) { return new PrimitiveType(repetition, PrimitiveTypeName.DOUBLE, name); } else if (typeInfo.equals(TypeInfoFactory.floatTypeInfo)) { return new PrimitiveType(repetition, PrimitiveTypeName.FLOAT, name); } else if (typeInfo.equals(TypeInfoFactory.booleanTypeInfo)) { return new PrimitiveType(repetition, PrimitiveTypeName.BOOLEAN, name); } else if (typeInfo.equals(TypeInfoFactory.binaryTypeInfo)) { // TODO : binaryTypeInfo is a byte array. Need to map it throw new UnsupportedOperationException("Binary type not implemented"); } else if (typeInfo.equals(TypeInfoFactory.timestampTypeInfo)) { throw new UnsupportedOperationException("Timestamp type not implemented"); } else if (typeInfo.equals(TypeInfoFactory.voidTypeInfo)) { throw new UnsupportedOperationException("Void type not implemented"); } else if (typeInfo.equals(TypeInfoFactory.unknownTypeInfo)) { throw new UnsupportedOperationException("Unknown type not implemented"); } else { throw new IllegalArgumentException("Unknown type: " + typeInfo); } } else if (typeInfo.getCategory().equals(Category.LIST)) { return convertArrayType(name, (ListTypeInfo) typeInfo); } else if (typeInfo.getCategory().equals(Category.STRUCT)) { return convertStructType(name, (StructTypeInfo) typeInfo); } else if (typeInfo.getCategory().equals(Category.MAP)) { return convertMapType(name, (MapTypeInfo) typeInfo); } else if (typeInfo.getCategory().equals(Category.UNION)) { throw new UnsupportedOperationException("Union type not implemented"); } else { throw new IllegalArgumentException("Unknown type: " + typeInfo); } }
Example 4
Source File: JsonElementConversionFactory.java From incubator-gobblin with Apache License 2.0 | 4 votes |
public BooleanConverter(JsonSchema schema, boolean repeated) { super(schema, repeated, PrimitiveTypeName.BOOLEAN); }