You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/01/26 02:04:00 UTC

[jira] [Resolved] (CALCITE-2147) GroupingSets involving rollup resulting into an incorrect plan

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

Julian Hyde resolved CALCITE-2147.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.16.0

Fixed in [1bd6839b|http://git-wip-us.apache.org/repos/asf/calcite/commit/1bd6839b]; thanks for the PR, [~rmunjam]!

> GroupingSets involving rollup resulting into an incorrect plan
> --------------------------------------------------------------
>
>                 Key: CALCITE-2147
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2147
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Vamshi
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.16.0
>
>
> Problem description:
> When rollup or cube expressions are specified as input to grouping_sets ,then instead of handling the rollup or cube expression in LogicalAggregate operator  they are handled in LogicalProject operator which is incorrect.
>  
> Basically grouping_sets with rollup/cube expressions as input is not flattened into logical aggregate operator.
>  
> Problem Test case:
> create table temp11(a integer, b integer);
> select a,b,count(*) from temp11 group by grouping sets(rollup(a,b),a,b,());
> Test Case output:
> {
>   "rels": [
>     {
>       "id": "0",
>       "relOp": "LogicalTableScan",
>       "table": [
>         "CATALOG",
>         "temp11"
>       ],
>       "inputs": []
>     },
>     {
>       "id": "1",
>       "relOp": "LogicalProject",
>       "fields": [
>         "$f0",
>         "a",
>         "b"
>       ],
>       "exprs": [
>         {
>           "op": "ROLLUP",          <<--- Incorrect expressioin in LogicalProject operator.
>           "operands": [
>             {
>               "input": 0,
>               "name": "$0"
>             },
>             {
>               "input": 1,
>               "name": "$1"
>             }
>           ]
>         },
>         {
>           "input": 0,
>           "name": "$0"
>         },
>         {
>           "input": 1,
>           "name": "$1"
>         }
>       ]
>     },
>     {
>       "id": "2",
>       "relOp": "LogicalAggregate",
>       "group": [
>         0,
>         1,
>         2
>       ],
>       "groups": [
>         [
>           0
>         ],
>         [
>           1
>         ],
>         [
>           2
>         ],
>         []
>       ],
>       "aggs": [
>         {
>           "agg": "COUNT",
>           "type": {
>             "type": "BIGINT",
>             "nullable": false
>           },
>           "distinct": false,
>           "operands": []
>         }
>       ]
>     },
>     {
>       "id": "3",
>       "relOp": "LogicalProject",
>       "fields": [
>         "a",
>         "b",
>         "EXPR$2"
>       ],
>       "exprs": [
>         {
>           "input": 1,
>           "name": "$1"
>         },
>         {
>           "input": 2,
>           "name": "$2"
>         },
>         {
>           "input": 3,
>           "name": "$3"
>         }
>       ]
>     }
>   ]
> }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)