apache/druid · error · IllegalArgumentException

Cannot hide column %s

Error message

Cannot hide column %s

What it means

DatasourceDefn validation rejects attempts to hide the __time column. The __time primary time column is fundamental to Druid segmentation and cannot be marked hidden in a datasource definition's hiddenColumns property.

Source

Thrown at server/src/main/java/org/apache/druid/catalog/model/table/DatasourceDefn.java:152

  }

  public static class HiddenColumnsDefn extends StringListPropertyDefn
  {
    public HiddenColumnsDefn()
    {
      super(HIDDEN_COLUMNS_PROPERTY);
    }

    @Override
    public void validate(Object value, ObjectMapper jsonMapper)
    {
      if (value == null) {
        return;
      }
      List<String> hiddenColumns = decode(value, jsonMapper);
      for (String col : hiddenColumns) {
        if (Columns.TIME_COLUMN.equals(col)) {
          throw new IAE(
              StringUtils.format("Cannot hide column %s", col)
          );
        }
      }
    }
  }

  public static class ClusterKeysDefn extends ModelProperties.ListPropertyDefn<ClusterKeySpec>
  {
    public ClusterKeysDefn()
    {
      super(
          CLUSTER_KEYS_PROPERTY,
          "ClusterKeySpec list",
          new TypeReference<>() {}
      );
    }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Remove '__time' from the hiddenColumns list in the datasource spec.
  2. Use a query-level projection instead to exclude __time from results.
  3. Filter the desired hidden columns before saving the spec.
  4. If __time must not appear, alias/select only needed columns in SQL.

Example fix

// before
"hiddenColumns": ["__time", "userId"]
// after
"hiddenColumns": ["userId"]
Defensive patterns

Strategy: validation

Validate before calling

List<String> hidden = spec.getHiddenColumns();
if (hidden != null && hidden.contains("__time")) {
  throw new IllegalArgumentException("__time cannot be hidden");
}

Try / catch

try { saveSpec(spec); } catch (IAE e) { if (e.getMessage().startsWith("Cannot hide column")) { spec.setHiddenColumns(remove(spec.getHiddenColumns(), "__time")); saveSpec(spec); } }

Prevention

When it happens

Trigger: Creating or updating a datasource whose 'hiddenColumns' property includes '__time'; the validate method decodes the value and throws when any entry equals Columns.TIME_COLUMN.

Common situations: Copy-pasting a full column list into hiddenColumns including __time; tooling auto-generating hidden columns from a schema snapshot; trying to 'remove' the time column from output.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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