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

Aman Sinha commented on DRILL-1846:
-----------------------------------

Here's the plan.  Note the SingleMergeExchange operator 02-02 expects the 
output degree of parallelism to be exactly 1.  However, it appears that when we 
determine the parallelism for fragment 02 we use a higher value.  
{code}
0: jdbc:drill:zk=local> explain plan for select n_nationkey from  (select 
n_nationkey, n_regionkey from cp.`tpch/nation.parquet` order by n_regionkey) n 
order by n.n_nationkey;
+------------+------------+
|    text    |    json    |
+------------+------------+
| 00-00    Screen
00-01      SingleMergeExchange(sort0=[0 ASC])
01-01        SelectionVectorRemover
01-02          Sort(sort0=[$0], dir0=[ASC])
01-03            HashToRandomExchange(dist0=[[$0]])
02-01              Project(n_nationkey=[$0])
02-02                SingleMergeExchange(sort0=[1 ASC])
03-01                  SelectionVectorRemover
03-02                    Sort(sort0=[$1], dir0=[ASC])
03-03                      HashToRandomExchange(dist0=[[$1]])
04-01                        Project(n_nationkey=[$1], n_regionkey=[$0])
04-02                          Scan(groupscan=[ParquetGroupScan 
[entries=[ReadEntryWithPath [path=/tpch/nation.parquet]], 
selectionRoot=/tpch/nation.parquet, numFiles=1, columns=[`n_nationkey`, 
`n_regionkey`]]])
{code}

> Re-ordering output of a subquery on a different column causes error
> -------------------------------------------------------------------
>
>                 Key: DRILL-1846
>                 URL: https://issues.apache.org/jira/browse/DRILL-1846
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Aman Sinha
>            Assignee: Aman Sinha
>
> In the following the subquery does an order by on n_regionkey and the outer 
> query does another order-by on n_nationkey.  I have to set the slice_target = 
> 1 for this particular data set but for the general case it is not needed.  
> This query errors out:
> {code}
> alter session set `planner.slice_target` = 1
>  select n.n_nationkey 
>       from  (select n_nationkey, n_regionkey from cp.`tpch/nation.parquet` 
>                    order by n_regionkey) n 
>   order by n.n_nationkey;
>   Query failed: Query failed: Unexpected exception during fragment 
> initialization: SingleMergeExchange only supports a single receiver endpoint
> {code}



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

Reply via email to