[
https://issues.apache.org/jira/browse/DRILL-7509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17015793#comment-17015793
]
ASF GitHub Bot commented on DRILL-7509:
---------------------------------------
ihuzenko commented on 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_r366491059
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/FileMetadataCollector.java
##########
@@ -278,17 +273,71 @@ static ColTypeInfo of(MessageType schema, Type type,
String[] path, int depth, L
int repetitionLevel = schema.getMaxRepetitionLevel(path);
int definitionLevel = schema.getMaxDefinitionLevel(path);
- return new ColTypeInfo(type.getOriginalType(), parentTypes, precision,
scale, repetitionLevel, definitionLevel);
+ Type.Repetition repetition;
+ // Check if the primitive has LIST as parent, if it does - this is an
array of primitives.
+ // (See ParquetReaderUtility#isLogicalListType(GroupType) for the
REPEATED field structure.)
+ if (parentTypes.size() - 2 >= 0 && parentTypes.get(parentTypes.size()
- 2) == OriginalType.LIST) {
Review comment:
please use local variable to eliminate magic number confusion, for example:
```java
int probableListIdx = parentTypes.size() - 2;
if (probableListIdx >= 0 && parentTypes.get(probableListIdx) ==
OriginalType.LIST) {
```
----------------------------------------------------------------
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:
[email protected]
> Incorrect TupleSchema is created for DICT column when querying Parquet files
> ----------------------------------------------------------------------------
>
> Key: DRILL-7509
> URL: https://issues.apache.org/jira/browse/DRILL-7509
> Project: Apache Drill
> Issue Type: Bug
> Affects Versions: 1.16.0
> Reporter: Bohdan Kazydub
> Assignee: Bohdan Kazydub
> Priority: Major
> Fix For: 1.18.0
>
>
> When {{DICT}} column is queried from Parquet file, its {{TupleSchema}}
> contains nested element, e.g. `map`, itself contains `key` and `value`
> fields, rather than containing the `key` and `value` fields in the {{DICT}}'s
> {{TupleSchema}} itself. The nested element, `map`, comes from the inner
> structure of Parquet's {{MAP}} (which corresponds to Drill's {{DICT}})
> representation.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)