apache/druid · error · IllegalArgumentException
Received a non-applicable rewrite: %s, filter's dimension: %
Error message
Received a non-applicable rewrite: %s, filter's dimension: %s
What it means
TypedInFilter.rewriteRequiredColumns rewrites the filter to operate on a different column per the supplied map. It throws IAE when the map has no entry for the filter's own dimension, meaning the rewrite is not applicable to this filter. This is an internal invariant check used when rewriting filters onto unnest/expr columns.
Source
Thrown at processing/src/main/java/org/apache/druid/query/filter/TypedInFilter.java:355
@Override
public boolean canVectorizeMatcher(ColumnInspector inspector)
{
return true;
}
@Override
public boolean supportsRequiredColumnRewrite()
{
return true;
}
@Override
public Filter rewriteRequiredColumns(Map<String, String> columnRewrites)
{
String rewriteDimensionTo = columnRewrites.get(column);
if (rewriteDimensionTo == null) {
throw new IAE("Received a non-applicable rewrite: %s, filter's dimension: %s", columnRewrites, column);
}
if (rewriteDimensionTo.equals(column)) {
return this;
} else {
return new TypedInFilter(
rewriteDimensionTo,
matchValueType,
null,
sortedMatchValues.get(),
filterTuning
);
}
}
@Override
public String toString()
{View on GitHub (pinned to 9b90983fd2)
Solutions
- Ensure the rewrite map contains a mapping for the filter's dimension (columnRewrites.get(filter.getColumn()) != null) before calling rewriteRequiredColumns.
- Only propagate rewrites to filters whose column appears in the map; skip others instead of rewriting them.
- Check upstream logic that builds the rewrite map so it covers all columns used by the filter tree.
Example fix
// before
Filter rewritten = filter.rewriteRequiredColumns(Map.of("other", "unnest_col"));
// after
String target = Map.of("other", "unnest_col").get(filter.getColumn());
Filter rewritten = target == null ? filter : filter.rewriteRequiredColumns(Map.of(filter.getColumn(), "unnest_col")); Defensive patterns
Strategy: validation
Validate before calling
if (columnRewrites == null || columnRewrites.get(filter.getColumn()) == null) { throw new IllegalArgumentException("rewrite map missing column " + filter.getColumn()); } Type guard
boolean applicable = (filter instanceof TypedInFilter) && columnRewrites.containsKey(((TypedInFilter) filter).getColumn());
Try / catch
try { rewritten = filter.rewriteRequiredColumns(rewrites); } catch (IllegalArgumentException e) { rewritten = filter; } Prevention
- Always include every filter column in the rewrite map
- Check map coverage against filter.getRequiredColumns() before rewriting
- Skip leaf filters whose column is absent from the map
When it happens
Trigger: Calling rewriteRequiredColumns with a map whose keys do not include the filter's `column` (e.g. rewriting on an unrelated output column, or an empty map).
Common situations: Native query rewrites around unnested columns in SQL planning; code paths that apply a single column-rewrite map to a compound filter where some leaf filters reference columns absent from the map.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Required column rewrite is not supported by this filter.
- Escape must be null or a single character
- A-Not-B requires at least 1 sketch
- Illegal number of fields[%d], must be > 1
- Specify exactly one of 'interval' and 'segments'
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/1e15851b72c53591.
Report an issue: GitHub.