You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Jacques Nadeau (JIRA)" <ji...@apache.org> on 2014/06/09 07:35:09 UTC

[jira] [Resolved] (DRILL-382) Doing Sort above an aggregate operator with group-by changes the ordinal position of columns

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

Jacques Nadeau resolved DRILL-382.
----------------------------------

    Resolution: Fixed

> Doing Sort above an aggregate operator with group-by changes the ordinal position of columns
> --------------------------------------------------------------------------------------------
>
>                 Key: DRILL-382
>                 URL: https://issues.apache.org/jira/browse/DRILL-382
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Aman Sinha
>
> Doing a Sort above a grouping aggregate operator (either Streaming Aggr or Hash Aggr) produces output columns whose ordinal positions are non-deterministic.  See the output of the first and second runs below.  The physical plan to reproduce this is given further below.  Do we need a final Project to ensure the correct/consistent order of the columns ? 
> First run:
> ----------------------------------
> | Y              | $f0            |
> -----------------------------------
> | 50             | 0              |
> | 47             | 1              |
> | 68             | 2              |
> | 77             | 3              |
> | 58             | 4              |
> -----------------------------------
> Second run:
> -----------------------------------
> | $f0            | Y              |
> -----------------------------------
> | 0              | 50             |
> | 1              | 47             |
> | 2              | 68             |
> | 3              | 77             |
> | 4              | 58             |
> -----------------------------------
> Plan: 
> {
>   head : {
>     version : 1,
>     generator : {
>       type : "optiq",
>       info : "na"
>     },
>     type : "APACHE_DRILL_PHYSICAL"
>   },
>   graph : [ {
>     pop : "parquet-scan",
>     @id : 1,
>     entries : [ {
>       path : "/tmp/parquet/nation.parquet"
>     } ],
>     storageengine : {
>       type : "parquet",
>       dfsName : "file:///"
>     },
>     ref : "_MAP",
>     fragmentPointer : 0
>   }, {
>     pop : "project",
>     @id : 2,
>     exprs : [ {
>       ref : "output.$f0",
>       expr : "_MAP.N_REGIONKEY"
>     }, {
>       ref : "output.$f1",
>       expr : "_MAP.N_NATIONKEY"
>     } ],
>     child : 1
>   }, {
>     pop : "sort",
>     @id : 3,
>     child : 2,
>     orderings : [ {
>       order : "ASC",
>       expr : "$f0"
>     } ],
>     reverse : false
>   }, {
>     pop : "streaming-aggregate",
>     @id : 4,
>     child : 3,
>     keys : [ {
>       ref : "$f0",
>       expr : "$f0"
>     } ],
>     exprs : [ {
>       ref : "Y",
>       expr : "sum($f1) "
>     } ]
>   }, {
>     pop : "sort",
>     @id : 5,
>     child : 4,
>     orderings : [ {
>       order : "ASC",
>       expr : "$f0"
>     }, {
>       order : "ASC",
>       expr : "Y"
>     } ]
>   }, {
>     pop : "selection-vector-remover",
>     @id : 6,
>     child : 5
>   }, {
>     pop : "screen",
>     @id : 7,
>     child : 6
>   } ]
> }



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