apache/druid · error · IllegalArgumentException
Received a non-applicable rewrite
Error message
Received a non-applicable rewrite: %s, filter's dimension: %s
What it means
EqualityFilter.rewriteRequiredColumns() rewrites the filter's equality column based on a columnRewrites map. When the map has no entry for this filter's column, the rewrite cannot be applied and Druid throws this IAE. The source mistakenly passes columnRewrites twice as format args, so the reported 'dimension' shows the map.
Solutions
- Ensure the rewrite map contains a mapping for the equality filter's column
- Check columnRewrites.containsKey(filter.getColumn()) before calling rewriteRequiredColumns
- Build the map from the filter tree's actual columns rather than assuming fixed names
Example fix
// before
Map.of("channel", "channel_renamed") // filter's column is "page"
// after
Map.of("page", "page_renamed") Defensive patterns
Strategy: validation
Validate before calling
if (!columnRewrites.containsKey(equalityFilter.getColumn())) {
throw new IllegalArgumentException("rewrite map missing column: " + equalityFilter.getColumn());
} Type guard
boolean applicable = columnRewrites != null && columnRewrites.containsKey(equalityFilter.getColumn());
Try / catch
try {
return filter.rewriteRequiredColumns(columnRewrites);
} catch (IAE e) {
if (e.getMessage().contains("non-applicable rewrite")) { return filter; }
throw e;
} Prevention
- Derive rewrite maps by scanning all filters for their columns
- Keep rewrite maps in sync with datasource schema changes
- Unit-test rewriteRequiredColumns with each filter type
When it happens
Trigger: Invoking rewriteRequiredColumns on an EqualityFilter with a map missing the key matching the filter's column field.
Common situations: Join/subtotal query rewrites where the rewrite map was built against different column names; nested filter trees where only some equality filters reference the rewritten column.
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/86585728149ce0db.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/filter/EqualityFilter.java:295
@Override
public Set<String> getRequiredColumns()
{
return ImmutableSet.of(column);
}
@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,
columnRewrites
);
}
return new EqualityFilter(
rewriteDimensionTo,
matchValueType,
matchValue,
filterTuning
);
}
/**
* Can the match value type be cast directly to column type for equality comparison? For non-numeric match types, we
* just use exact string equality regardless of the column type. For numeric match value types against string columns,
* we instead cast the string to the match value type number for matching equality.View on GitHub (pinned to 9b90983fd2)