TypeDescription key = schema.getChildren().get(0); TypeDescription value = schema.getChildren().get(1); return Types.MapType.ofOptional(columnIds.get(key), columnIds.get(value), convertOrcToType(key, columnIds), convertOrcToType(value, columnIds));
Types.MapType.ofRequired(2, 3, Types.StringType.get(), from))); Types.MapType.ofRequired(2, 3, from, Types.StringType.get())));
Schema writeSchema = new Schema( Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of( Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of(
Schema writeSchema = new Schema( Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of( Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of(
Schema writeSchema = new Schema( Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of( Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of(
Schema writeSchema = new Schema( Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of( Record l1 = GenericRecord.create(writeSchema.findType("locations").asMapType().valueType().asStructType()); l1.setField("lat", 53.992811f); l1.setField("long", -1.542616f); Record l2 = GenericRecord.create(writeSchema.findType("locations").asMapType().valueType().asStructType()); l2.setField("lat", 52.995143f); l2.setField("long", -1.539054f); Types.NestedField.optional(5, "locations", Types.MapType.ofOptional(6, 7, Types.StringType.get(), Types.StructType.of(
optional(9, "newfeature", Types.BooleanType.get()) )), required(4, "locations", Types.MapType.ofRequired(10, 11, Types.StructType.of( required(20, "address", Types.StringType.get()),
optional(9, "feature2", Types.BooleanType.get()) )), required(4, "locations", Types.MapType.ofRequired(10, 11, Types.StructType.of( required(20, "address", Types.StringType.get()), Types.DoubleType.get() )), optional(7, "properties", Types.MapType.ofOptional(18, 19, Types.StringType.get(), Types.StringType.get()
optional(9, "newfeature", Types.BooleanType.get()) )), required(4, "locations", Types.MapType.ofRequired(10, 11, Types.StructType.of( required(20, "address", Types.StringType.get()), Types.DoubleType.get() )), optional(7, "properties", Types.MapType.ofOptional(18, 19, Types.StringType.get(), Types.StringType.get()
null == TypeUtil.find( schema, type -> type.isMapType() && type.asMapType().keyType() != Types.StringType.get()));
@Test public void testAddNestedMapOfStructs() { Schema schema = new Schema(required(1, "id", Types.IntegerType.get())); Types.MapType map = Types.MapType.ofOptional(1, 2, Types.StructType.of( required(20, "address", Types.StringType.get()), optional(2, "locations", Types.MapType.ofOptional(3, 4, Types.StructType.of( required(5, "address", Types.StringType.get()),
optional(9, "feature2", Types.BooleanType.get()) )), required(4, "locations", Types.MapType.ofRequired(10, 11, Types.StructType.of( required(20, "address", Types.StringType.get()), Types.DoubleType.get() )), optional(7, "properties", Types.MapType.ofOptional(18, 19, Types.StringType.get(), Types.StringType.get()