diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/MapKeyValuesSchemaConverter.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/MapKeyValuesSchemaConverter.java index 8f51fe21d476..c0c9347c50b9 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/MapKeyValuesSchemaConverter.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/MapKeyValuesSchemaConverter.java @@ -144,8 +144,12 @@ else if (typeInfo.getCategory() == Category.UNION) { private static GroupType convertArrayType(String name, ListTypeInfo typeInfo) { TypeInfo subType = typeInfo.getListElementTypeInfo(); - return listWrapper(name, LogicalTypeAnnotation.listType(), new GroupType(Repetition.REPEATED, - ParquetHiveSerDe.ARRAY.toString(), convertType("array_element", subType))); + return listWrapper( + name, + new GroupType( + Repetition.REPEATED, + ParquetHiveSerDe.ARRAY.toString(), + convertType("array_element", subType))); } // An optional group containing multiple elements @@ -171,10 +175,9 @@ public static GroupType mapType(Repetition repetition, String alias, String mapA { //support projection only on key of a map if (valueType == null) { - return listWrapper( + return mapKvWrapper( repetition, alias, - LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance(), new GroupType( Repetition.REPEATED, mapAlias, @@ -184,10 +187,9 @@ public static GroupType mapType(Repetition repetition, String alias, String mapA if (!valueType.getName().equals("value")) { throw new RuntimeException(valueType.getName() + " should be value"); } - return listWrapper( + return mapKvWrapper( repetition, alias, - LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance(), new GroupType( Repetition.REPEATED, mapAlias, @@ -196,16 +198,16 @@ public static GroupType mapType(Repetition repetition, String alias, String mapA } } - private static GroupType listWrapper(Repetition repetition, String alias, LogicalTypeAnnotation logicalType, Type nested) + private static GroupType mapKvWrapper(Repetition repetition, String alias, Type nested) { if (!nested.isRepetition(Repetition.REPEATED)) { throw new IllegalArgumentException("Nested type should be repeated: " + nested); } - return Types.buildGroup(repetition).as(logicalType).addField(nested).named(alias); + return Types.buildGroup(repetition).as(LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance()).addField(nested).named(alias); } - private static GroupType listWrapper(String name, LogicalTypeAnnotation logicalType, GroupType groupType) + private static GroupType listWrapper(String name, GroupType groupType) { - return Types.optionalGroup().as(logicalType).addField(groupType).named(name); + return Types.optionalGroup().as(LogicalTypeAnnotation.listType()).addField(groupType).named(name); } } diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArrayMapKeyValuesSchemaConverter.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArrayMapKeyValuesSchemaConverter.java index 82cb87d714c3..51fd1381a60b 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArrayMapKeyValuesSchemaConverter.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArrayMapKeyValuesSchemaConverter.java @@ -149,7 +149,7 @@ private static Type convertType(String name, TypeInfo typeInfo, Repetition repet private static GroupType convertArrayType(String name, ListTypeInfo typeInfo, Repetition repetition) { TypeInfo subType = typeInfo.getListElementTypeInfo(); - return listWrapper(name, LogicalTypeAnnotation.listType(), convertType("array_element", subType, Repetition.REPEATED), repetition); + return listWrapper(name, convertType("array_element", subType, Repetition.REPEATED), repetition); } // An optional group containing multiple elements @@ -175,10 +175,9 @@ public static GroupType mapType(Repetition repetition, String alias, String mapA { //support projection only on key of a map if (valueType == null) { - return listWrapper( + return mapKvWrapper( repetition, alias, - LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance(), new GroupType( Repetition.REPEATED, mapAlias, @@ -187,10 +186,9 @@ public static GroupType mapType(Repetition repetition, String alias, String mapA if (!valueType.getName().equals("value")) { throw new RuntimeException(valueType.getName() + " should be value"); } - return listWrapper( + return mapKvWrapper( repetition, alias, - LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance(), new GroupType( Repetition.REPEATED, mapAlias, @@ -198,16 +196,16 @@ public static GroupType mapType(Repetition repetition, String alias, String mapA valueType)); } - private static GroupType listWrapper(Repetition repetition, String alias, LogicalTypeAnnotation logicalType, Type nested) + private static GroupType mapKvWrapper(Repetition repetition, String alias, Type nested) { if (!nested.isRepetition(Repetition.REPEATED)) { throw new IllegalArgumentException("Nested type should be repeated: " + nested); } - return Types.buildGroup(repetition).as(logicalType).addField(nested).named(alias); + return Types.buildGroup(repetition).as(LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance()).addField(nested).named(alias); } - private static GroupType listWrapper(String name, LogicalTypeAnnotation logicalType, Type elementType, Repetition repetition) + private static GroupType listWrapper(String name, Type elementType, Repetition repetition) { - return Types.buildGroup(repetition).as(logicalType).addField(elementType).named(name); + return Types.buildGroup(repetition).as(LogicalTypeAnnotation.listType()).addField(elementType).named(name); } } diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArraySchemaConverter.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArraySchemaConverter.java index d051478869ac..f508b4dfb290 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArraySchemaConverter.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/parquet/write/SingleLevelArraySchemaConverter.java @@ -161,7 +161,7 @@ else if (typeInfo.getCategory() == Category.UNION) { private static GroupType convertArrayType(String name, ListTypeInfo typeInfo, Repetition repetition) { TypeInfo subType = typeInfo.getListElementTypeInfo(); - return listWrapper(name, LogicalTypeAnnotation.listType(), convertType("array", subType, Repetition.REPEATED), repetition); + return listWrapper(name, convertType("array", subType, Repetition.REPEATED), repetition); } // An optional group containing multiple elements @@ -183,9 +183,8 @@ private static GroupType convertMapType(String name, MapTypeInfo typeInfo, Repet return ConversionPatterns.mapType(repetition, name, keyType, valueType); } - private static GroupType listWrapper(String name, LogicalTypeAnnotation logicalType, - Type elementType, Repetition repetition) + private static GroupType listWrapper(String name, Type elementType, Repetition repetition) { - return Types.buildGroup(repetition).as(logicalType).addField(elementType).named(name); + return Types.buildGroup(repetition).as(LogicalTypeAnnotation.listType()).addField(elementType).named(name); } }