Skip to content

Commit 0d6d07f

Browse files
authored
Merge pull request #17 from bigo-sg/allow_map_key_optional
Allow Parquet map key to be optional
2 parents d03245f + 5612187 commit 0d6d07f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cpp/src/parquet/arrow/schema.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,23 @@ Status MapToSchemaField(const GroupNode& group, LevelInfo current_levels,
548548
return Status::Invalid("Key-value map node must have 1 or 2 child elements. Found: ",
549549
key_value.field_count());
550550
}
551+
552+
/*
553+
* If Parquet file was written by Flink, key type of map column is allowed to be optional, like this:
554+
* optional group event_info (MAP) {
555+
* repeated group key_value {
556+
* optional binary key (UTF8);
557+
* optional binary value (UTF8);
558+
* }
559+
* }
560+
*
561+
* Refer to: https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/dev/table/types/#constructured-data-types
551562
const Node& key_node = *key_value.field(0);
552563
if (!key_node.is_required()) {
553564
return Status::Invalid("Map keys must be annotated as required.");
554565
}
566+
*/
567+
555568
// Arrow doesn't support 1 column maps (i.e. Sets). The options are to either
556569
// make the values column nullable, or process the map as a list. We choose the latter
557570
// as it is simpler.

0 commit comments

Comments
 (0)