Tomer Shiran created DRILL-1629:
-----------------------------------

             Summary: Cast issue during query
                 Key: DRILL-1629
                 URL: https://issues.apache.org/jira/browse/DRILL-1629
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Tomer Shiran


Imported Yelp user.json file into a local MongoDB instance (via mongoimport). 
Ran the following query to find the names of the users who had the most reviews:

{code}
0: jdbc:drill:zk=local> SELECT u.user_id, u.name, count(*) reviews FROM 
mongo.yelp.users u, dfs.yelp.`yelp_academic_dataset_review.json` r WHERE 
u.user_id = r.user_id GROUP BY u.user_id, u.name ORDER BY reviews DESC LIMIT 10;
Query failed: Failure while running fragment. Failure finding function that 
runtime code generation expected.  Signature: compare_to( 
VARCHAR:OPTIONALINT:OPTIONAL,  ) returns INT:REQUIRED 
[c796f1fb-b73a-49e8-8b4a-ed973d89b7d3]

Error: exception while executing query: Failure while trying to get next result 
batch. (state=,code=0)
{code}

Here's the explain plan:

{code}
0: jdbc:drill:zk=local> EXPLAIN PLAN FOR SELECT u.user_id, u.name, count(*) 
reviews FROM mongo.yelp.users u, dfs.yelp.`yelp_academic_dataset_review.json` r 
WHERE u.user_id = r.user_id GROUP BY u.user_id, u.name ORDER BY reviews DESC 
LIMIT 10;
+------------+------------+
|    text    |    json    |
+------------+------------+
| 00-00    Screen
00-01      Project(user_id=[$0], name=[$1], reviews=[$2])
00-02        SelectionVectorRemover
00-03          Limit(fetch=[10])
00-04            SingleMergeExchange(sort0=[2 DESC])
01-01              SelectionVectorRemover
01-02                TopN(limit=[10])
01-03                  HashToRandomExchange(dist0=[[$2]])
02-01                    HashAgg(group=[{0, 1}], reviews=[COUNT()])
02-02                      Project(user_id=[$0], name=[$1])
02-03                        HashJoin(condition=[=($0, $2)], joinType=[inner])
02-05                          HashToRandomExchange(dist0=[[$0]])
03-01                            Scan(groupscan=[MongoGroupScan 
[MongoScanSpec=MongoScanSpec [dbName=yelp, collectionName=users, filters=null], 
columns=[SchemaPath [`user_id`], SchemaPath [`name`]]]])
02-04                          HashToRandomExchange(dist0=[[$0]])
04-01                            Project(T8¦¦*=[$0])
04-02                              Project(T8¦¦*=[$0], T8¦¦user_id=[$ |
+------------+------------+
1 row selected (0.42 seconds)
{code}



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

Reply via email to