apache/druid · error · IllegalArgumentException

Column[ ] is not a valid column

Error message

Column[%d] is not a valid column

What it means

columnReader(column) looks up a precomputed column function by index; an out-of-range or unknown column index yields null and the Reader implementation throws IAE because there is no valid column at that position.

Solutions

  1. Use a valid column index within 0..rowSignature.size()-1
  2. Resolve column indexes via table.rowSignature().indexOf(columnName) instead of hardcoding
  3. Refresh any cached column ordinals after schema changes
  4. Check for negative/off-by-one index computation

Example fix

// before
Reader reader = table.columnReader(7);
// after
int col = table.rowSignature().indexOf("columnName");
if (col < 0) { throw new IllegalArgumentException("unknown column"); }
Reader reader = table.columnReader(col);
Defensive patterns

Strategy: type-guard

Validate before calling

if (column < 0 || column >= table.rowSignature().size()) { throw new IllegalArgumentException("invalid column " + column); }

Type guard

boolean validColumn = column >= 0 && column < table.rowSignature().size();

Try / catch

try { reader = table.columnReader(col); } catch (IAE e) { /* re-resolve column ordinal */ }

Prevention

When it happens

Trigger: Calling IndexedTable.columnReader(int) (e.g. via makeColumnSelectorFactory / join matcher column access) with an index >= number of columns or a negative index not present in columnFunctions.

Common situations: Outdated column ordinal cached after the table schema changed; off-by-one when iterating column indexes; custom code reading a column index from a mismatched signature.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/join/table/RowBasedIndexedTable.java:154

  @Override
  public RowSignature rowSignature()
  {
    return rowSignature;
  }

  @Override
  public Index columnIndex(int column)
  {
    return getKeyColumnIndex(column, indexes);
  }

  @Override
  public Reader columnReader(int column)
  {
    final Function<RowType, Object> columnFn = columnFunctions.get(column);

    if (columnFn == null) {
      throw new IAE("Column[%d] is not a valid column", column);
    }

    return row -> columnFn.apply(table.get(row));
  }

  @Override
  public byte[] computeCacheKey()
  {
    return Preconditions.checkNotNull(cacheKey, "Cache key can't be null");
  }

  @Override
  public boolean isCacheable()
  {
    return (null != cacheKey);
  }

  @Override

View on GitHub (pinned to 9b90983fd2)