apache/druid · error · IllegalArgumentException

Duplicate column names are not allowed in RowSignature

Error message

Duplicate column names are not allowed in RowSignature

What it means

In MSQResultsReport.toRowSignature, after building a RowSignature from the results' ColumnAndType list, the built signature's size is compared to the input list size. RowSignature silently deduplicates duplicate names, so a size mismatch proves the query produced duplicate column names in its output — which would corrupt result reporting — and this IAE rejects it.

Solutions

  1. Rewrite the query to alias duplicate output columns to distinct names (e.g. SELECT f(x) AS x_sum, f(y) AS y_sum).
  2. Check the SQL for repeated output column names or self-joins producing colliding names.
  3. If generated by a planner, report a bug: MSQ should deduplicate/verify output column names earlier.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at multi-stage-query/src/main/java/org/apache/druid/msq/indexing/report/MSQResultsReport.java:148 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/42ebec70425473ca. Report an issue: GitHub.

Appendix: source

Thrown at multi-stage-query/src/main/java/org/apache/druid/msq/indexing/report/MSQResultsReport.java:148

    {
      return Objects.hash(name, type);
    }

    @Override
    public String toString()
    {
      return name + ":" + type;
    }

    public static RowSignature toRowSignature(List<ColumnAndType> columnAndTypes)
    {
      final RowSignature.Builder builder = RowSignature.builder();
      for (MSQResultsReport.ColumnAndType columnAndType : columnAndTypes) {
        builder.add(columnAndType.getName(), columnAndType.getType());
      }
      RowSignature rowSignature = builder.build();
      if (rowSignature.size() != columnAndTypes.size()) {
        throw new IllegalArgumentException("Duplicate column names are not allowed in RowSignature");
      }
      return rowSignature;
    }
  }
}

View on GitHub (pinned to 9b90983fd2)