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

Aggregate operators may derive row types with duplicate column names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.4.0-incubating
    • None
    • 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.

      Attachments

        Activity

          People

            jcamacho Jesús Camacho Rodríguez
            jcamacho Jesús Camacho Rodríguez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: