apache/druid · error · IllegalArgumentException
Received a non-applicable rewrite
Error message
Received a non-applicable rewrite: %s, filter's dimension: %s
What it means
InDimFilter.rewriteRequiredColumns() rewrites the filter's dimension using a columnRewrites map during query rewriting. If the map lacks an entry for the filter's dimension, the rewrite is non-applicable and Druid throws this IAE naming the map and the dimension. Called by callers such as rewrittenFilter when rewriting filter trees.
Solutions
- Add a mapping for the InDimFilter's dimension to columnRewrites
- Guard with columnRewrites.containsKey(filter.getDimension()) before rewriting
- Use rewrite() with the appropriate rewriter if the rewrite should be conditional
Example fix
// before
inFilter.rewriteRequiredColumns(Map.of("colA", "colA2")); // dimension is "colB"
// after
inFilter.rewriteRequiredColumns(Map.of("colB", "colB2")); Defensive patterns
Strategy: validation
Validate before calling
if (!columnRewrites.containsKey(inFilter.getDimension())) {
throw new IllegalArgumentException("rewrite map missing dimension: " + inFilter.getDimension());
} Type guard
boolean applicable = columnRewrites != null && columnRewrites.containsKey(inFilter.getDimension());
Try / catch
try {
return filter.rewriteRequiredColumns(columnRewrites);
} catch (IAE e) {
if (e.getMessage().contains("non-applicable rewrite")) { return filter; }
throw e;
} Prevention
- Include InDimFilter dimensions in any column rewrite map
- Verify rewritten queries with a dry-run before submission
- Use filter-tree traversal to construct complete rewrite maps
When it happens
Trigger: Calling rewriteRequiredColumns on an InDimFilter whose dimension is not a key in the supplied columnRewrites map.
Common situations: Query rewrite passes (joins, subtotals, query migrations) where the map covers other columns; constructing the rewrite map from a partial set of columns.
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
- Received a non-applicable rewrite
- Received a non-applicable rewrite
- Received a non-applicable rewrite
- Received a non-applicable rewrite
- Escape must be null or a single character
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/821f98f294744e3a.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java:361
@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(dimension);
if (rewriteDimensionTo == null) {
throw new IAE("Received a non-applicable rewrite: %s, filter's dimension: %s", columnRewrites, dimension);
}
if (rewriteDimensionTo.equals(dimension)) {
return this;
} else {
return new InDimFilter(
rewriteDimensionTo,
values,
extractionFn,
filterTuning,
predicateFactory
);
}
}
@Override
public String toString()
{View on GitHub (pinned to 9b90983fd2)