You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jesus Camacho Rodriguez (JIRA)" <ji...@apache.org> on 2015/11/03 16:46:27 UTC

[jira] [Created] (CALCITE-948) Indicator columns not preserved by RelFieldTrimmer

Jesus Camacho Rodriguez created CALCITE-948:
-----------------------------------------------

             Summary: Indicator columns not preserved by RelFieldTrimmer
                 Key: CALCITE-948
                 URL: https://issues.apache.org/jira/browse/CALCITE-948
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Jesus Camacho Rodriguez
            Assignee: Jesus Camacho Rodriguez


CALCITE-828 introduced the usage of RelBuilder in RelFieldTrimmer. In Hive, we are hitting an issue in RelFieldTrimmer with the following query:
{noformat}
SELECT a FROM T1 GROUP BY a GROUPING SETS (a);
{noformat}

The problem is that the {{indicator}} boolean in the Aggregate operator is set to true, as grouping sets are present. In particular, the plan is the following:
{noformat}
HiveAggregate(group=[{0}] indicator=[true])
  HiveProject(a=[$0])
    HiveTableScan(table=[[default.t1]])
{noformat}

However, RelFieldTrimmer will remove the indicator columns, as the number of GroupingSets is <1. This creates a mismatch in the number of columns that results in assertion error. By the definition of the trim function over an Aggregate in RelFieldTrimmer, indicator columns should not be removed.

PS. I tried to reproduce the issue in Calcite using the following query:
{noformat}
select ename, grouping(ename) from emp group by ename, grouping sets (ename)
{noformat}
But I could not, as Calcite infers directly the constant value for the grouping column.



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