[
https://issues.apache.org/jira/browse/DRILL-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14521091#comment-14521091
]
Steven Phillips commented on DRILL-2919:
----------------------------------------
As Abhishek said, use the flatten function to achieve your desired results.
At the same time, I think the bug in this case is that we didn't fail the query.
We shouldn't allow skipping the array segment of a field path, at least until
we have a more precise definition for what that would mean.
For example, in the future, we could allow expression like:
select a.b[*].c ...
which would return a list of the "c" elements from each of the elements of b.
And the expression
select a.b.c ...
could be equivalent in the case that b is a repeated type.
But I don't think simply returning the first element is the correct thing to
do, which is what we are doing now. Until this sort of expression is supported,
we should fail the query.
> Drill not resolving repeated values in json
> -------------------------------------------
>
> Key: DRILL-2919
> URL: https://issues.apache.org/jira/browse/DRILL-2919
> Project: Apache Drill
> Issue Type: Bug
> Components: Storage - JSON
> Affects Versions: 0.8.0
> Reporter: mohit kaushik
> Assignee: Steven Phillips
> Labels: features
>
> I have a json file in HDFS named autom.json contains.
> {
> "company": [
> {
> "modelName": {
> "name": "abc"
> }
> },
> {
> "modelName": {
> "name": "xyz"
> }
> }
> ]
> }
> When i query
> select t.company.`modelName` from hdfs.`autom.json` t ;
> it gives result
> {"name":"abc"}
> However, The expected result was both entries.
> {"name":"abc"}
> {"name":"xyz"}
> Even when I query
> select t.company.`modelName` from hdfs.`autom.json` t where
> t.company.`modelName`.`name`='xyz' ;
> it does not find anything.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)