Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-753

Aggregate operators may derive row types with duplicate column names

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0-incubating
    • Component/s: None
    • Labels:
      None

      Description

      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:

      Aggregate (f1, sum(f1)) 
        Union
          Aggregate (x, sum(x)) ...
          Aggregate (x, sum(x))  ...
      

      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.

        Activity

        Hide
        jnadeau Jacques Nadeau added a comment -

        Resolved in release 1.4.0-incubating (2015-08-23)

        Show
        jnadeau Jacques Nadeau added a comment - Resolved in release 1.4.0-incubating (2015-08-23)
        Show
        jcamachorodriguez Jesus Camacho Rodriguez added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/ccdda9b2

          People

          • Assignee:
            jcamachorodriguez Jesus Camacho Rodriguez
            Reporter:
            jcamachorodriguez Jesus Camacho Rodriguez
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development