@Test public void testReassignIdsDuplicateColumns() { Schema schema = new Schema( required(0, "a", Types.IntegerType.get()), required(1, "A", Types.IntegerType.get()) ); Schema sourceSchema = new Schema( required(1, "a", Types.IntegerType.get()), required(2, "A", Types.IntegerType.get()) ); final Schema actualSchema = TypeUtil.reassignIds(schema, sourceSchema); Assert.assertEquals(sourceSchema.asStruct(), actualSchema.asStruct()); }
public static Schema reassignIds(Schema schema, Schema idSourceSchema) { Types.StructType struct = visit(schema, new ReassignIds(idSourceSchema)).asStructType(); return new Schema(struct.fields()); }
TypeUtil { public static Schema reassignIds(Schema schema, Schema idSourceSchema) { Types.StructType struct = visit(schema, new ReassignIds(idSourceSchema)).asStructType(); return new Schema(struct.fields()); } }
TypeUtil { public static Schema reassignIds(Schema schema, Schema idSourceSchema) { Types.StructType struct = visit(schema, new ReassignIds(idSourceSchema)).asStructType(); return new Schema(struct.fields()); } private  TypeUtil(); }
TypeUtil { public static Schema reassignIds(Schema schema, Schema idSourceSchema) { Types.StructType struct = visit(schema, new ReassignIds(idSourceSchema)).asStructType(); return new Schema(struct.fields()); } private  TypeUtil(); static Schema select(Schema schema, Set<Integer> fieldIds); static Types.StructType select(Types.StructType struct, Set<Integer> fieldIds); static Set<Integer> getProjectedIds(Schema schema); static Set<Integer> getProjectedIds(Type type); static Types.StructType selectNot(Types.StructType struct, Set<Integer> fieldIds); static Schema selectNot(Schema schema, Set<Integer> fieldIds); static Schema join(Schema left, Schema right); static Map<String, Integer> indexByName(Types.StructType struct); static Map<String, Integer> indexByLowerCaseName(Types.StructType struct); static Map<Integer, Types.NestedField> indexById(Types.StructType struct); static Map<Integer, Integer> indexParents(Types.StructType struct); static Type assignFreshIds(Type type, NextID nextId); static Schema assignFreshIds(Schema schema, NextID nextId); static Schema assignIncreasingFreshIds(Schema schema); static Schema reassignIds(Schema schema, Schema idSourceSchema); static Type find(Schema schema, Predicate<Type> predicate); static boolean isPromotionAllowed(Type from, Type.PrimitiveType to); static void validateWriteSchema(Schema tableSchema, Schema writeSchema,
                                         Boolean checkNullability, Boolean checkOrdering); static T visit(Schema schema, SchemaVisitor<T> visitor); static T visit(Type type, SchemaVisitor<T> visitor); static T visit(Schema schema, CustomOrderSchemaVisitor<T> visitor); static T visit(Type type, CustomOrderSchemaVisitor<T> visitor); static int decimalRequiredBytes(int precision); }
TypeUtil { public static Schema reassignIds(Schema schema, Schema idSourceSchema) { Types.StructType struct = visit(schema, new ReassignIds(idSourceSchema)).asStructType(); return new Schema(struct.fields()); } private  TypeUtil(); static Schema select(Schema schema, Set<Integer> fieldIds); static Types.StructType select(Types.StructType struct, Set<Integer> fieldIds); static Set<Integer> getProjectedIds(Schema schema); static Set<Integer> getProjectedIds(Type type); static Types.StructType selectNot(Types.StructType struct, Set<Integer> fieldIds); static Schema selectNot(Schema schema, Set<Integer> fieldIds); static Schema join(Schema left, Schema right); static Map<String, Integer> indexByName(Types.StructType struct); static Map<String, Integer> indexByLowerCaseName(Types.StructType struct); static Map<Integer, Types.NestedField> indexById(Types.StructType struct); static Map<Integer, Integer> indexParents(Types.StructType struct); static Type assignFreshIds(Type type, NextID nextId); static Schema assignFreshIds(Schema schema, NextID nextId); static Schema assignIncreasingFreshIds(Schema schema); static Schema reassignIds(Schema schema, Schema idSourceSchema); static Type find(Schema schema, Predicate<Type> predicate); static boolean isPromotionAllowed(Type from, Type.PrimitiveType to); static void validateWriteSchema(Schema tableSchema, Schema writeSchema,
                                         Boolean checkNullability, Boolean checkOrdering); static T visit(Schema schema, SchemaVisitor<T> visitor); static T visit(Type type, SchemaVisitor<T> visitor); static T visit(Schema schema, CustomOrderSchemaVisitor<T> visitor); static T visit(Type type, CustomOrderSchemaVisitor<T> visitor); static int decimalRequiredBytes(int precision);  }