You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2020/01/15 12:22:47 UTC
[GitHub] [drill] KazydubB commented on a change in pull request #1954:
DRILL-7509: Incorrect TupleSchema is created for DICT column when querying
Parquet files
KazydubB commented on a change in pull request #1954: DRILL-7509: Incorrect TupleSchema is created for DICT column when querying Parquet files
URL: https://github.com/apache/drill/pull/1954#discussion_r366847315
##########
File path: exec/vector/src/main/java/org/apache/drill/exec/record/metadata/MetadataUtils.java
##########
@@ -187,6 +187,10 @@ public static ColumnMetadata newMapArray(String name, TupleMetadata schema) {
return new MapColumnMetadata(name, DataMode.REPEATED, (TupleSchema) schema);
}
+ public static DictColumnMetadata newDictArray(String name, TupleMetadata schema) {
+ return new DictColumnMetadata(name, DataMode.REPEATED, (TupleSchema) schema);
Review comment:
Let me explain: Dict stores `key` and `value` `ColumnMetadata`s in `TupleSchema` - the way Map's members are stored - but there's a validation for each of the fields (name, type). Dict does not contain a Map, it stores its `key` and `value` in its `TupleSchema schema` field.
When `TupleMetadata` is constructed for Parquet table as part of table metadata, we loop over each Parquet field's `SchemaPath` representation (leaf fields, e.g. `` `mapcol`.`map`.`key` ``, `` `structcol`.`b` `` with the last field in schema being a primitive). Such named segments are treated as either a (Drill's) `MAP` or `DICT`, depending on parent segment type.
(Parquet's) `MAP` is represented as a group (note, that nested group's name, `key_value` below, can be different, based on the system which produced the Parquet file):
```
<map-repetition> group <name> (MAP) {
repeated group key_value {
required <key-type> key;
<value-repetition> <value-type> value;
}
}
```
and before changes in the PR, when `TupleMetadata` was being created for the table, if `DICT` column was encountered, it included a nested `key_value` group as Drill's `MAP` which then contained `key` and `value` fields. Thus, there is a need to skip this segment if we know that its parent's type is `DICT` to have correct `ColumnMetadata` for the `DICT` field.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services