Abhishek Girish created DRILL-1558:
--------------------------------------

             Summary: Count(<ArrayColumn>) 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


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[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)

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




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

Reply via email to