[ 
https://issues.apache.org/jira/browse/DRILL-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14098071#comment-14098071
 ] 

Aman Sinha commented on DRILL-1241:
-----------------------------------

Every operator should return an output schema even if there are no records (see 
previously fixed bug DRILL-884).  In this particular bug, the LIMIT operator 
was not obeying that policy.  Fixed by adding the appropriate handling for such 
case in LimitRecordBatch.   Added various unit tests with Limit 0 on  scans, 
joins, aggregations; also tested with non-zero Offsets.  

> Query that returns 0 rows gives alarming error
> ----------------------------------------------
>
>                 Key: DRILL-1241
>                 URL: https://issues.apache.org/jira/browse/DRILL-1241
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: DrillCommitter
>             Fix For: 0.5.0
>
>         Attachments: 
> 0001-DRILL-1241-Ensure-that-Limit-produces-at-least-1-bat.patch
>
>
> When I run a query with 'limit 0' I got an error that sounded like an 
> internal protocol error.
> {code:sql}
> 0: jdbc:drill:zk=local> SELECT * FROM cp.`employee.json` limit 0;
> Query failed: Failure while running fragment. The incoming iterator returned 
> a state of NONE on the first batch. There should always be at least one batch 
> output before returning NONE [a7416ee7-1d9c-4591-a927-2664455f3ef1]
> Error: exception while executing query: Failure while trying to get next 
> result batch. (state=,code=0)
> {code}
> Should be more like a user error, since Drill cannot handle queries that 
> return 0 rows. Or maybe (if as I surmise the problem is that Drill just 
> doesn't know the names of the columns) generate a default column 
> 'unknown_result_set_schema' and no rows.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to