{"record":{"id":"23fbd92be055d34c","repo":"apache/druid","slug":"required-column-rewrite-is-not-supported-by-this-f","errorCode":null,"errorMessage":"Required column rewrite is not supported by this filter.","messagePattern":"Required column rewrite is not supported by this filter\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/filter/Filter.java","lineNumber":183,"sourceCode":"  default boolean supportsRequiredColumnRewrite()\n  {\n    return false;\n  }\n\n  /**\n   * Return a copy of this filter that is identical to the this filter except that it operates on different columns,\n   * based on a renaming map where the key is the column to be renamed in the filter, and the value is the new\n   * column name.\n   * <p>\n   * For example, if I have a filter (A = hello), and I have a renaming map (A -> B),\n   * this should return the filter (B = hello)\n   *\n   * @param columnRewrites Column rewrite map\n   * @return Copy of this filter that operates on new columns based on the rewrite map\n   */\n  default Filter rewriteRequiredColumns(Map<String, String> columnRewrites)\n  {\n    throw new UnsupportedOperationException(\"Required column rewrite is not supported by this filter.\");\n  }\n}\n","sourceCodeStart":165,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/filter/Filter.java#L165-L186","documentation":"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.","triggerScenarios":"Calling rewriteFilterRequiredColumns / rewriteFilterOnUnnestColumnIfPossible on a filter class that does not override rewriteRequiredColumns (e.g. custom filters or unsupported built-ins).","commonSituations":"SQL-to-native unnest rewrites encountering a filter type added before rewrite support existed; third-party filter extensions.","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."],"exampleFix":"// before\nFilter rewritten = filter.rewriteRequiredColumns(rewrites);\n// after\nFilter rewritten;\ntry {\n  rewritten = filter.rewriteRequiredColumns(rewrites);\n} catch (UnsupportedOperationException e) {\n  rewritten = filter; // keep original when rewrite unsupported\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { rewritten = filter.rewriteRequiredColumns(rewrites); } catch (UnsupportedOperationException e) { rewritten = filter; }","preventionTips":["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"],"tags":["druid","filter","column-rewrite","unsupported-operation"],"backgroundTag":"operation-not-supported","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}