@Test public void testRoundtripConversionPrimitive() { Schema expectedSchema = new Schema( optional(1, "intCol", Types.IntegerType.get()), optional(3, "longCol", Types.LongType.get()), optional(6, "intCol2", Types.IntegerType.get()), optional(20, "intCol3", Types.IntegerType.get()), required(9, "doubleCol", Types.DoubleType.get()), required(10, "uuidCol", Types.UUIDType.get()), optional(2, "booleanCol", Types.BooleanType.get()), optional(21, "fixedCol", Types.FixedType.ofLength(4096)), required(22, "binaryCol", Types.BinaryType.get()), required(23, "stringCol", Types.StringType.get()), required(24, "decimalCol", Types.DecimalType.of(15, 3)), required(25, "floatCol", Types.FloatType.get()), optional(30, "dateCol", Types.DateType.get()), required(32, "timeCol", Types.TimeType.get()), required(34, "timestampCol", Types.TimestampType.withZone()) ); TypeDescription orcSchema = ORCSchemaUtil.convert(expectedSchema); assertEquals(expectedSchema.asStruct(), ORCSchemaUtil.convert(orcSchema).asStruct()); }
public static TypeDescription convert(Schema schema) { final TypeDescription root = TypeDescription.createStruct(); final Types.StructType schemaRoot = schema.asStruct(); for (Types.NestedField field : schemaRoot.asStructType().fields()) { TypeDescription orcColumType = convert(field.fieldId(), field.type(), field.isRequired()); root.addField(field.name(), orcColumType); } return root; }
ORCSchemaUtil { public static TypeDescription convert(Schema schema) { final TypeDescription root = TypeDescription.createStruct(); final Types.StructType schemaRoot = schema.asStruct(); for (Types.NestedField field : schemaRoot.asStructType().fields()) { TypeDescription orcColumType = convert(field.fieldId(), field.type(), field.isRequired()); root.addField(field.name(), orcColumType); } return root; } }
ORCSchemaUtil { public static TypeDescription convert(Schema schema) { final TypeDescription root = TypeDescription.createStruct(); final Types.StructType schemaRoot = schema.asStruct(); for (Types.NestedField field : schemaRoot.asStructType().fields()) { TypeDescription orcColumType = convert(field.fieldId(), field.type(), field.isRequired()); root.addField(field.name(), orcColumType); } return root; } private  ORCSchemaUtil(); }
ORCSchemaUtil { public static TypeDescription convert(Schema schema) { final TypeDescription root = TypeDescription.createStruct(); final Types.StructType schemaRoot = schema.asStruct(); for (Types.NestedField field : schemaRoot.asStructType().fields()) { TypeDescription orcColumType = convert(field.fieldId(), field.type(), field.isRequired()); root.addField(field.name(), orcColumType); } return root; } private  ORCSchemaUtil(); static TypeDescription convert(Schema schema); static Schema convert(TypeDescription orcSchema); static TypeDescription buildOrcProjection(Schema schema,
                                                   TypeDescription originalOrcSchema); static Map<Integer, String> idToOrcName(Schema schema); }
ORCSchemaUtil { public static TypeDescription convert(Schema schema) { final TypeDescription root = TypeDescription.createStruct(); final Types.StructType schemaRoot = schema.asStruct(); for (Types.NestedField field : schemaRoot.asStructType().fields()) { TypeDescription orcColumType = convert(field.fieldId(), field.type(), field.isRequired()); root.addField(field.name(), orcColumType); } return root; } private  ORCSchemaUtil(); static TypeDescription convert(Schema schema); static Schema convert(TypeDescription orcSchema); static TypeDescription buildOrcProjection(Schema schema,
                                                   TypeDescription originalOrcSchema); static Map<Integer, String> idToOrcName(Schema schema); static final String ICEBERG_BINARY_TYPE_ATTRIBUTE; static final String ICEBERG_LONG_TYPE_ATTRIBUTE; }