You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Mohit Kaushik <mo...@orkash.com> on 2015/04/30 08:44:40 UTC

drill gives first result for repeated values

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.



Re: drill gives first result for repeated values

Posted by Tomer Shiran <ts...@gmail.com>.
Check out the FLATTEN function:
https://cwiki.apache.org/confluence/display/DRILL/FLATTEN+Function

On Wed, Apr 29, 2015 at 11:44 PM, Mohit Kaushik <mo...@orkash.com>
wrote:

> 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.
>
>
>