[ 
https://issues.apache.org/jira/browse/DRILL-1558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Abhishek Girish updated DRILL-1558:
-----------------------------------
    Description: 
Works:
> select count(`type`) from yelp_academic_dataset_review;
+------------+
|   EXPR$0   |
+------------+
| 1125458    |
+------------+
1 row selected (0.065 seconds)

Fails:

> select count(`votes`) from yelp_academic_dataset_review;
+------------+
|   EXPR$0   |
+------------+
| 0          |
+------------+

> select count(`votes`) from `yelp_academic_dataset_review.json`;
Query failed: Screen received stop request sent. Failure while materializing 
expression. 
Error in expression at index -1.  Error: Missing function implementation: 
[count(MAP-REQUIRED)].  Full expression: --UNKNOWN EXPRESSION. 
[e4cdd655-cc87-4803-9b25-555779161ec6]

Error: exception while executing query: Failure while trying to get next result 
batch. (state=,code=0)
0: jdbc:drill:zk=10.10.103.34:5181> select count(`text`) from 
`yelp_academic_dataset_review.json`;


Sample data:
+------------+------------+------------+------------+------------+------------+------------+-------------+
|   votes    |  user_id   | review_id  |   stars    |    date    |    text    | 
   type    | business_id |
+------------+------------+------------+------------+------------+------------+------------+-------------+
| {"funny":0,"useful":0,"cool":0} | 3MSa_fdxgsaY9yF9vqmeUg | 
ag1fnnEmc2yernTW2ur2eg | 5          | 2010-09-07 | Great food and service | 
review     | KPoTixdjoJxSqRSEApSAGg |
| {"funny":0,"useful":0,"cool":0} | f3LA83yEEBMj9q92H28O7w | 
LNW2d7TDLB7XHT-V8k-6Jg | 4          | 2010-09-08 | I haven't been in a while 
but I remember being impressed.  Nice amb |
| {"funny":0,"useful":0,"cool":0} | SaC2fZjZZfWV-8wYb6o6fw | 
449K7FhWs5Hn1xB1Qv8KPw | 4          | 2010-09-18 | Finally got to eat at this 
place after driving by so many times.  I |
| {"funny":0,"useful":0,"cool":0} | Sg9eHImUp1DMYhY7gA2img | 
yjEOpYaOnahtzCHBzY6KUg | 3          | 2010-09-27 | It was fine.  A fine thai 
meal to have before a rock show downtown. |


  was:
Works:
> select count(`type`) from yelp_academic_dataset_review;
+------------+
|   EXPR$0   |
+------------+
| 1125458    |
+------------+
1 row selected (0.065 seconds)

Fails:

I. Without specifying index
> select count(`votes`) from yelp_academic_dataset_review;
+------------+
|   EXPR$0   |
+------------+
| 0          |
+------------+

> select count(`votes`) from `yelp_academic_dataset_review.json`;
Query failed: Screen received stop request sent. Failure while materializing 
expression. 
Error in expression at index -1.  Error: Missing function implementation: 
[count(MAP-REQUIRED)].  Full expression: --UNKNOWN EXPRESSION. 
[e4cdd655-cc87-4803-9b25-555779161ec6]

Error: exception while executing query: Failure while trying to get next result 
batch. (state=,code=0)
0: jdbc:drill:zk=10.10.103.34:5181> select count(`text`) from 
`yelp_academic_dataset_review.json`;


II. Specifying Index - Format: JSON
> select count(`votes[0]`) from `yelp_academic_dataset_review.json`;
+------------+
|   EXPR$0   |
+------------+
| 0          |
+------------+
1 row selected (116.563 seconds)

> select count(`votes[1]`) from `yelp_academic_dataset_review.json`;
+------------+
|   EXPR$0   |
+------------+
| 0          |
+------------+
1 row selected (138.264 seconds)

III. Specifying Index - Format: Parquet converted from JSON
> select count(`votes[0]`) from yelp_academic_dataset_review;
+------------+
|   EXPR$0   |
+------------+
| 0          |
+------------+
1 row selected (0.118 seconds)

> select count(`votes[1]`) from yelp_academic_dataset_review;
+------------+
|   EXPR$0   |
+------------+
| 0          |
+------------+
1 row selected (0.061 seconds)

Sample data:
+------------+------------+------------+------------+------------+------------+------------+-------------+
|   votes    |  user_id   | review_id  |   stars    |    date    |    text    | 
   type    | business_id |
+------------+------------+------------+------------+------------+------------+------------+-------------+
| {"funny":0,"useful":0,"cool":0} | 3MSa_fdxgsaY9yF9vqmeUg | 
ag1fnnEmc2yernTW2ur2eg | 5          | 2010-09-07 | Great food and service | 
review     | KPoTixdjoJxSqRSEApSAGg |
| {"funny":0,"useful":0,"cool":0} | f3LA83yEEBMj9q92H28O7w | 
LNW2d7TDLB7XHT-V8k-6Jg | 4          | 2010-09-08 | I haven't been in a while 
but I remember being impressed.  Nice amb |
| {"funny":0,"useful":0,"cool":0} | SaC2fZjZZfWV-8wYb6o6fw | 
449K7FhWs5Hn1xB1Qv8KPw | 4          | 2010-09-18 | Finally got to eat at this 
place after driving by so many times.  I |
| {"funny":0,"useful":0,"cool":0} | Sg9eHImUp1DMYhY7gA2img | 
yjEOpYaOnahtzCHBzY6KUg | 3          | 2010-09-27 | It was fine.  A fine thai 
meal to have before a rock show downtown. |



> Count(<NestedDataInColumn>) does not work on JSON (and JSON-converted-Parquet)
> ------------------------------------------------------------------------------
>
>                 Key: DRILL-1558
>                 URL: https://issues.apache.org/jira/browse/DRILL-1558
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Metadata
>            Reporter: Abhishek Girish
>            Assignee: Jason Altekruse
>
> Works:
> > select count(`type`) from yelp_academic_dataset_review;
> +------------+
> |   EXPR$0   |
> +------------+
> | 1125458    |
> +------------+
> 1 row selected (0.065 seconds)
> Fails:
> > select count(`votes`) from yelp_academic_dataset_review;
> +------------+
> |   EXPR$0   |
> +------------+
> | 0          |
> +------------+
> > select count(`votes`) from `yelp_academic_dataset_review.json`;
> Query failed: Screen received stop request sent. Failure while materializing 
> expression. 
> Error in expression at index -1.  Error: Missing function implementation: 
> [count(MAP-REQUIRED)].  Full expression: --UNKNOWN EXPRESSION. 
> [e4cdd655-cc87-4803-9b25-555779161ec6]
> Error: exception while executing query: Failure while trying to get next 
> result batch. (state=,code=0)
> 0: jdbc:drill:zk=10.10.103.34:5181> select count(`text`) from 
> `yelp_academic_dataset_review.json`;
> Sample data:
> +------------+------------+------------+------------+------------+------------+------------+-------------+
> |   votes    |  user_id   | review_id  |   stars    |    date    |    text    
> |    type    | business_id |
> +------------+------------+------------+------------+------------+------------+------------+-------------+
> | {"funny":0,"useful":0,"cool":0} | 3MSa_fdxgsaY9yF9vqmeUg | 
> ag1fnnEmc2yernTW2ur2eg | 5          | 2010-09-07 | Great food and service | 
> review     | KPoTixdjoJxSqRSEApSAGg |
> | {"funny":0,"useful":0,"cool":0} | f3LA83yEEBMj9q92H28O7w | 
> LNW2d7TDLB7XHT-V8k-6Jg | 4          | 2010-09-08 | I haven't been in a while 
> but I remember being impressed.  Nice amb |
> | {"funny":0,"useful":0,"cool":0} | SaC2fZjZZfWV-8wYb6o6fw | 
> 449K7FhWs5Hn1xB1Qv8KPw | 4          | 2010-09-18 | Finally got to eat at this 
> place after driving by so many times.  I |
> | {"funny":0,"useful":0,"cool":0} | Sg9eHImUp1DMYhY7gA2img | 
> yjEOpYaOnahtzCHBzY6KUg | 3          | 2010-09-27 | It was fine.  A fine thai 
> meal to have before a rock show downtown. |



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to