apache/druid · error · UnsupportedOperationException
Required column rewrite is not supported by this filter.
Error message
Required column rewrite is not supported by this filter.
What it means
Filter.rewriteRequiredColumns is a default no-op throwing UnsupportedOperationException; only filters that support column rewriting override it. Thrown when a caller attempts to rewrite a filter type (or filter tree containing a type) that does not implement rewriting.
Source
Thrown at processing/src/main/java/org/apache/druid/query/filter/Filter.java:183
default boolean supportsRequiredColumnRewrite()
{
return false;
}
/**
* Return a copy of this filter that is identical to the this filter except that it operates on different columns,
* based on a renaming map where the key is the column to be renamed in the filter, and the value is the new
* column name.
* <p>
* For example, if I have a filter (A = hello), and I have a renaming map (A -> B),
* this should return the filter (B = hello)
*
* @param columnRewrites Column rewrite map
* @return Copy of this filter that operates on new columns based on the rewrite map
*/
default Filter rewriteRequiredColumns(Map<String, String> columnRewrites)
{
throw new UnsupportedOperationException("Required column rewrite is not supported by this filter.");
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Upgrade or implement rewriteRequiredColumns for the filter type.
- Skip rewriting filters that do not support it (catch the exception and keep the original filter).
- Use a supported filter equivalent (e.g. selector/in/and/or) that implements column rewriting.
Example fix
// before
Filter rewritten = filter.rewriteRequiredColumns(rewrites);
// after
Filter rewritten;
try {
rewritten = filter.rewriteRequiredColumns(rewrites);
} catch (UnsupportedOperationException e) {
rewritten = filter; // keep original when rewrite unsupported
} Defensive patterns
Strategy: try-catch
Try / catch
try { rewritten = filter.rewriteRequiredColumns(rewrites); } catch (UnsupportedOperationException e) { rewritten = filter; } Prevention
- Prefer filter types that implement rewriteRequiredColumns (selector, in, and, or, not)
- Guard unnest-rewrite passes with capability checks
- Keep custom filters in sync with Filter interface defaults
When it happens
Trigger: Calling rewriteFilterRequiredColumns / rewriteFilterOnUnnestColumnIfPossible on a filter class that does not override rewriteRequiredColumns (e.g. custom filters or unsupported built-ins).
Common situations: SQL-to-native unnest rewrites encountering a filter type added before rewrite support existed; third-party filter extensions.
Related errors
- Received a non-applicable rewrite: %s, filter's dimension: %
- Filter[%s] cannot vectorize
- Not implemented
- Not implemented
- Not implemented
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/23fbd92be055d34c.
Report an issue: GitHub.