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
- Remove '__time' from the hiddenColumns list in the datasource spec.
- Use a query-level projection instead to exclude __time from results.
- Filter the desired hidden columns before saving the spec.
- 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
- Never include __time in hiddenColumns
- Filter the column list before persisting specs
- Use query projections to exclude __time from results
- Review auto-generated hidden column lists for __time
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
- Cannot specify DESC clustering key [%s]. Only ASC is support
- Cannot handle dataSource [%s]
- Must have exactly one child
- Expected a TableDataSource, got data source type [%s]
- Policy can't be null for RestrictedDataSource
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/4752ecf264c252f3.
Report an issue: GitHub.