Jesus Camacho Rodriguez created CALCITE-753:
-----------------------------------------------

             Summary: Aggregate operators may derive row types with duplicate 
column names
                 Key: CALCITE-753
                 URL: https://issues.apache.org/jira/browse/CALCITE-753
             Project: Calcite
          Issue Type: Bug
            Reporter: Jesus Camacho Rodriguez
            Assignee: Jesus Camacho Rodriguez


Aggregate operators may derive row types with duplicate column names. The 
reason is that the column names for grouping sets columns and aggregation 
columns might be generated automatically, but we do not check whether the 
column name already exists in the same row.

This condition may appear e.g. in the following plan:
{noformat}
Aggregate (f1, sum(f1)) 
  Union
    Aggregate (x, sum(x)) ...
    Aggregate (x, sum(x))  ...
{noformat}
where _f1_ is the column with the result of sum(_x_).

Calcite derives the row schema for the aggregation column sum(_f1_) 
automatically. The generated name is _f1_ ('f' of function, '1' of the position 
in the tuple), which is the same one that the first column has; however, 
Calcite is not verifying if the autogenerated name was already in the tuple or 
not. This patch checks if the name already exists, and while it does, it 
generates a new column name.



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

Reply via email to