Java Code Examples for org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName#toString()
The following examples show how to use
org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName#toString() .
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: TestTypeBuilders.java From parquet-mr with Apache License 2.0 | 6 votes |
@Test public void testPrimitiveTypeConstruction() { PrimitiveTypeName[] types = new PrimitiveTypeName[] { BOOLEAN, INT32, INT64, INT96, FLOAT, DOUBLE, BINARY }; for (PrimitiveTypeName type : types) { String name = type.toString() + "_"; for (Type.Repetition repetition : Type.Repetition.values()) { PrimitiveType expected = new PrimitiveType(repetition, type, name); PrimitiveType built = Types.primitive(type, repetition).named(name); Assert.assertEquals(expected, built); switch (repetition) { case REQUIRED: built = Types.required(type).named(name); break; case OPTIONAL: built = Types.optional(type).named(name); break; case REPEATED: built = Types.repeated(type).named(name); break; } Assert.assertEquals(expected, built); } } }
Example 2
Source File: TestTypeBuilders.java From parquet-mr with Apache License 2.0 | 5 votes |
@Test public void testTypeConstructionWithUndefinedColumnOrder() { PrimitiveTypeName[] types = new PrimitiveTypeName[] { BOOLEAN, INT32, INT64, INT96, FLOAT, DOUBLE, BINARY, FIXED_LEN_BYTE_ARRAY }; for (PrimitiveTypeName type : types) { String name = type.toString() + "_"; int len = type == FIXED_LEN_BYTE_ARRAY ? 42 : 0; PrimitiveType expected = new PrimitiveType(Repetition.OPTIONAL, type, len, name, null, null, null, ColumnOrder.undefined()); PrimitiveType built = Types.optional(type).length(len).columnOrder(ColumnOrder.undefined()).named(name); Assert.assertEquals(expected, built); } }
Example 3
Source File: TestTypeBuilders.java From parquet-mr with Apache License 2.0 | 5 votes |
@Test public void testTypeConstructionWithTypeDefinedColumnOrder() { PrimitiveTypeName[] types = new PrimitiveTypeName[] { BOOLEAN, INT32, INT64, FLOAT, DOUBLE, BINARY, FIXED_LEN_BYTE_ARRAY }; for (PrimitiveTypeName type : types) { String name = type.toString() + "_"; int len = type == FIXED_LEN_BYTE_ARRAY ? 42 : 0; PrimitiveType expected = new PrimitiveType(Repetition.OPTIONAL, type, len, name, null, null, null, ColumnOrder.typeDefined()); PrimitiveType built = Types.optional(type).length(len).columnOrder(ColumnOrder.typeDefined()).named(name); Assert.assertEquals(expected, built); } }
Example 4
Source File: UnknownColumnTypeException.java From parquet-mr with Apache License 2.0 | 4 votes |
public UnknownColumnTypeException(PrimitiveTypeName type) { super("Column type not found: " + type.toString()); this.type= type; }