This is an automated email from the ASF dual-hosted git repository.
gangwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-java.git
The following commit(s) were added to refs/heads/master by this push:
new 4fe2e90ef GH-3401: Remove redundant MAP_KEY_VALUE annotation at middle
level of logical type map (#3402)
4fe2e90ef is described below
commit 4fe2e90ef73df67b3ed51ffeb6487840fd450d13
Author: Zehua Zou <[email protected]>
AuthorDate: Wed Mar 4 12:49:11 2026 +0800
GH-3401: Remove redundant MAP_KEY_VALUE annotation at middle level of
logical type map (#3402)
---
.../main/java/org/apache/parquet/avro/package-info.java | 4 ++--
.../org/apache/parquet/avro/TestAvroSchemaConverter.java | 14 +++++++-------
.../java/org/apache/parquet/schema/ConversionPatterns.java | 13 ++-----------
.../src/main/java/org/apache/parquet/schema/Types.java | 4 ++--
.../apache/parquet/thrift/TestThriftSchemaConverter.java | 12 ++++++------
.../thrift/TestThriftSchemaConverterProjectUnion.java | 6 +++---
6 files changed, 22 insertions(+), 31 deletions(-)
diff --git
a/parquet-avro/src/main/java/org/apache/parquet/avro/package-info.java
b/parquet-avro/src/main/java/org/apache/parquet/avro/package-info.java
index fe412e001..7daff5927 100644
--- a/parquet-avro/src/main/java/org/apache/parquet/avro/package-info.java
+++ b/parquet-avro/src/main/java/org/apache/parquet/avro/package-info.java
@@ -77,7 +77,7 @@
* <tr>
* <td>map</td>
* <td>group (with original type MAP) containing one repeated group
- * field (with original type MAP_KEY_VALUE) of (key, value)</td>
+ * field of (key, value)</td>
* </tr>
* <tr>
* <td>fixed</td>
@@ -148,7 +148,7 @@
* </tr>
* <tr>
* <td>group (with original type MAP) containing one repeated group
- * field (with original type MAP_KEY_VALUE) of (key, value)</td>
+ * field of (key, value)</td>
* <td>map</td>
* </tr>
* </table>
diff --git
a/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
b/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
index 3a78eefbb..412e8f295 100644
---
a/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
+++
b/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
@@ -121,7 +121,7 @@ public class TestAvroSchemaConverter {
+ " }\n"
+ " }\n"
+ " required group mymap (MAP) {\n"
- + " repeated group map (MAP_KEY_VALUE) {\n"
+ + " repeated group map {\n"
+ " required binary key (UTF8);\n"
+ " required int32 value;\n"
+ " }\n"
@@ -214,13 +214,13 @@ public class TestAvroSchemaConverter {
+ " }\n"
+ " }\n"
+ " required group mymap (MAP) {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " required int32 value;\n"
+ " }\n"
+ " }\n"
+ " required group myemptymap (MAP) {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " required int32 value;\n"
+ " }\n"
@@ -261,13 +261,13 @@ public class TestAvroSchemaConverter {
+ " repeated int32 array;\n"
+ " }\n"
+ " required group mymap (MAP) {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " required int32 value;\n"
+ " }\n"
+ " }\n"
+ " required group myemptymap (MAP) {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " required int32 value;\n"
+ " }\n"
@@ -322,7 +322,7 @@ public class TestAvroSchemaConverter {
testRoundTripConversion(
schema,
"message record1 {\n" + " required group myintmap (MAP) {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " optional int32 value;\n"
+ " }\n"
@@ -977,7 +977,7 @@ public class TestAvroSchemaConverter {
+ " repeated int96 array;\n"
+ " }\n"
+ " required group mymap (MAP) {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (STRING);\n"
+ " required int96 value;\n"
+ " }\n"
diff --git
a/parquet-column/src/main/java/org/apache/parquet/schema/ConversionPatterns.java
b/parquet-column/src/main/java/org/apache/parquet/schema/ConversionPatterns.java
index e4ede9f15..2b812ff60 100644
---
a/parquet-column/src/main/java/org/apache/parquet/schema/ConversionPatterns.java
+++
b/parquet-column/src/main/java/org/apache/parquet/schema/ConversionPatterns.java
@@ -75,11 +75,7 @@ public abstract class ConversionPatterns {
repetition,
alias,
LogicalTypeAnnotation.mapType(),
- new GroupType(
- Repetition.REPEATED,
- mapAlias,
- LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance(),
- keyType));
+ new GroupType(Repetition.REPEATED, mapAlias, keyType));
} else {
if (!valueType.getName().equals("value")) {
throw new RuntimeException(valueType.getName() + " should be value");
@@ -88,12 +84,7 @@ public abstract class ConversionPatterns {
repetition,
alias,
LogicalTypeAnnotation.mapType(),
- new GroupType(
- Repetition.REPEATED,
- mapAlias,
- LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance(),
- keyType,
- valueType));
+ new GroupType(Repetition.REPEATED, mapAlias, keyType, valueType));
}
}
diff --git a/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
b/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
index 7298a356b..2f12991ab 100644
--- a/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
+++ b/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
@@ -110,7 +110,7 @@ import org.slf4j.LoggerFactory;
*
* <pre>
* // required group zipMap (MAP) {
- * // repeated group map (MAP_KEY_VALUE) {
+ * // repeated group map {
* // required float key
* // optional int32 value
* // }
@@ -122,7 +122,7 @@ import org.slf4j.LoggerFactory;
*
*
* // required group zipMap (MAP) {
- * // repeated group map (MAP_KEY_VALUE) {
+ * // repeated group map {
* // required group key {
* // optional int64 first;
* // required group second {
diff --git
a/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverter.java
b/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverter.java
index 8f9faf160..fd89ddc1c 100644
---
a/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverter.java
+++
b/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverter.java
@@ -145,7 +145,7 @@ public class TestThriftSchemaConverter {
message TestStructInMap {
optional binary name(UTF8);
optional group names(MAP) {
- repeated group map(MAP_KEY_VALUE) {
+ repeated group map {
required binary key(UTF8);
optional group value {
optional group name {
@@ -153,7 +153,7 @@ public class TestThriftSchemaConverter {
optional binary last_name(UTF8);
}
optional group phones(MAP) {
- repeated group map(MAP_KEY_VALUE) {
+ repeated group map {
required binary key(ENUM);
optional binary value(UTF8);
}
@@ -171,7 +171,7 @@ public class TestThriftSchemaConverter {
"name;names.key*;names.value",
"message ParquetSchema {\n" + " optional binary name (UTF8) = 1;\n"
+ " optional group names (MAP) = 2 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " optional group value {\n"
+ " optional group name = 1 {\n"
@@ -179,7 +179,7 @@ public class TestThriftSchemaConverter {
+ " optional binary last_name (UTF8) = 2;\n"
+ " }\n"
+ " optional group phones (MAP) = 2 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (ENUM);\n"
+ " optional binary value (UTF8);\n"
+ " }\n"
@@ -196,7 +196,7 @@ public class TestThriftSchemaConverter {
"name;names.key;names.value.name",
"message ParquetSchema {\n" + " optional binary name (UTF8) = 1;\n"
+ " optional group names (MAP) = 2 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " optional group value {\n"
+ " optional group name = 1 {\n"
@@ -217,7 +217,7 @@ public class TestThriftSchemaConverter {
"name;names.key",
"message ParquetSchema {\n" + " optional binary name (UTF8) = 1;\n"
+ " optional group names (MAP) = 2 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required binary key (UTF8);\n"
+ " optional group value {\n"
+ " optional group name = 1 {\n"
diff --git
a/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverterProjectUnion.java
b/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverterProjectUnion.java
index 4a2edd7d7..151e51cc3 100644
---
a/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverterProjectUnion.java
+++
b/parquet-thrift/src/test/java/org/apache/parquet/thrift/TestThriftSchemaConverterProjectUnion.java
@@ -315,7 +315,7 @@ public class TestThriftSchemaConverterProjectUnion {
"optMapWithUnionKey/key/**",
"optMapWithUnionKey.key",
"message ParquetSchema {\n" + " optional group optMapWithUnionKey
(MAP) = 1 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required group key {\n"
+ " optional group structV3 = 1 {\n"
+ " required binary name (UTF8) = 1;\n"
@@ -348,7 +348,7 @@ public class TestThriftSchemaConverterProjectUnion {
"optMapWithUnionKey/key/**;optMapWithUnionKey/value/gender",
"optMapWithUnionKey.{key,value.gender}",
"message ParquetSchema {\n" + " optional group optMapWithUnionKey
(MAP) = 1 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required group key {\n"
+ " optional group structV3 = 1 {\n"
+ " required binary name (UTF8) = 1;\n"
@@ -384,7 +384,7 @@ public class TestThriftSchemaConverterProjectUnion {
"optMapWithUnionValue/key/**;optMapWithUnionValue/value/structV4/addedStruct/gender",
"optMapWithUnionValue.{key,value.structV4.addedStruct.gender}",
"message ParquetSchema {\n" + " optional group optMapWithUnionValue
(MAP) = 1 {\n"
- + " repeated group key_value (MAP_KEY_VALUE) {\n"
+ + " repeated group key_value {\n"
+ " required group key {\n"
+ " required binary name (UTF8) = 1;\n"
+ " optional binary age (UTF8) = 2;\n"