@Test public void complexTypeEligibilityCheck() { TypeDescription struct_array_0 = TypeDescription.fromString("struct<first:array<int>,second:int>"); TypeDescription struct_array_1 = TypeDescription.fromString("struct<first:array<int>,second:int>"); Assert.assertTrue(OrcUtils.eligibleForUpConvert(struct_array_0, struct_array_1)); TypeDescription struct_array_2 = TypeDescription.fromString("struct<first:array<string>,second:int>"); Assert.assertFalse(OrcUtils.eligibleForUpConvert(struct_array_0, struct_array_2)); TypeDescription struct_map_0 = TypeDescription.fromString("struct<first:map<string,string>,second:int>"); TypeDescription struct_map_1 = TypeDescription.fromString("struct<first:map<string,string>,second:int>"); TypeDescription struct_map_2 = TypeDescription.fromString("struct<first:map<string,int>,second:int>"); TypeDescription struct_map_3 = TypeDescription.fromString("struct<second:int>"); Assert.assertTrue(OrcUtils.eligibleForUpConvert(struct_map_0, struct_map_1)); Assert.assertFalse(OrcUtils.eligibleForUpConvert(struct_map_0, struct_map_2)); Assert.assertTrue(OrcUtils.eligibleForUpConvert(struct_map_0, struct_map_3)); }
public static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema) { return eligibleForUpConvertHelper(originalSchema, targetSchema) || eligibleForUpConvertHelper(targetSchema, originalSchema); }
OrcUtils { public static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema) { return eligibleForUpConvertHelper(originalSchema, targetSchema) || eligibleForUpConvertHelper(targetSchema, originalSchema); } }
OrcUtils { public static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema) { return eligibleForUpConvertHelper(originalSchema, targetSchema) || eligibleForUpConvertHelper(targetSchema, originalSchema); } private  OrcUtils(); }
OrcUtils { public static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema) { return eligibleForUpConvertHelper(originalSchema, targetSchema) || eligibleForUpConvertHelper(targetSchema, originalSchema); } private  OrcUtils(); static TypeDescription getTypeDescriptionFromFile(Configuration conf, Path orcFilePath); static Reader getRecordReaderFromFile(Configuration conf, Path orcFilePath); static TypeDescription getNewestSchemaFromSource(Job job, FileSystem fs); @VisibleForTesting static void upConvertOrcStruct(OrcStruct oldStruct, OrcStruct newStruct, TypeDescription targetSchema); static void handlePrimitiveWritableComparable(WritableComparable from, WritableComparable to); static WritableComparable createValueRecursively(TypeDescription schema, int elemNum); static WritableComparable createValueRecursively(TypeDescription schema); static boolean eligibleForUpConvertHelper(TypeDescription originalSchema, TypeDescription targetSchema); static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema); }
OrcUtils { public static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema) { return eligibleForUpConvertHelper(originalSchema, targetSchema) || eligibleForUpConvertHelper(targetSchema, originalSchema); } private  OrcUtils(); static TypeDescription getTypeDescriptionFromFile(Configuration conf, Path orcFilePath); static Reader getRecordReaderFromFile(Configuration conf, Path orcFilePath); static TypeDescription getNewestSchemaFromSource(Job job, FileSystem fs); @VisibleForTesting static void upConvertOrcStruct(OrcStruct oldStruct, OrcStruct newStruct, TypeDescription targetSchema); static void handlePrimitiveWritableComparable(WritableComparable from, WritableComparable to); static WritableComparable createValueRecursively(TypeDescription schema, int elemNum); static WritableComparable createValueRecursively(TypeDescription schema); static boolean eligibleForUpConvertHelper(TypeDescription originalSchema, TypeDescription targetSchema); static boolean eligibleForUpConvert(TypeDescription originalSchema, TypeDescription targetSchema);  }