{"record":{"id":"72da000a30fb11f5","repo":"apache/druid","slug":"catalog-definition-for-the-s-input-source-alrea","errorCode":null,"errorMessage":"Catalog definition for the [%s] input source already contains column definitions","messagePattern":"Catalog definition for the \\[(.+?)\\] input source already contains column definitions","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/table/BaseInputSourceDefn.java","lineNumber":277,"sourceCode":"\n  /**\n   * Convert the format spec, if any, to an input format.\n   */\n  protected abstract InputFormat convertTableToFormat(ResolvedExternalTable table);\n\n  /**\n   *  Choose table or SQL-provided columns: table takes precedence.\n   */\n  protected List<ColumnSpec> selectPartialTableColumns(\n      final ResolvedExternalTable table,\n      final List<ColumnSpec> columns\n  )\n  {\n    final List<ColumnSpec> tableCols = table.resolvedTable().spec().columns();\n    if (CollectionUtils.isNullOrEmpty(tableCols)) {\n      return columns;\n    } else if (!CollectionUtils.isNullOrEmpty(columns)) {\n      throw new IAE(\n          \"Catalog definition for the [%s] input source already contains column definitions\",\n          typeValue()\n      );\n    } else {\n      return tableCols;\n    }\n  }\n}\n","sourceCodeStart":259,"sourceCodeEnd":286,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/table/BaseInputSourceDefn.java#L259-L286","documentation":"Thrown by BaseInputSourceDefn.selectPartialTableColumns when a catalog table definition supplies its own column list while the caller also passes explicit columns. Druid does not allow columns to be defined in both places for this input source; it either uses the provided columns or falls back to the table's catalog columns.","triggerScenarios":"Invoking a table function or query path that calls selectPartialTableColumns(columns) with a non-empty columns argument, when the underlying catalog table spec (table.resolvedTable().spec().columns()) already contains column definitions.","commonSituations":"A user defines a schema on the external table in the catalog and then also supplies a schema via TABLE(fn(...)(col type, ...)) in SQL; duplication of schema between catalog UI editing and SQL table function arguments.","solutions":["Remove the column definitions from the catalog table spec and supply them only in the call, or vice versa.","If the table's catalog schema is authoritative, pass null/empty columns to selectPartialTableColumns.","For ad-hoc TABLE() functions, create the external table without catalog columns.","Review the table definition in the catalog and drop the redundant columns section."],"exampleFix":"// before: table has columns in catalog AND fn(...) (<col> <type>) schema\n// after: remove columns from catalog spec, keep only the SQL schema\n{\"spec\":{\"table\":{\"columns\":[]},...}}","handlingStrategy":"validation","validationCode":"List<ColumnSpec> catalogCols = table.resolvedTable().spec().columns();\nif (!catalogCols.isEmpty() && columns != null && !columns.isEmpty()) {\n  throw new IllegalStateException(\"columns defined in both catalog spec and call arguments\");\n}","typeGuard":null,"tryCatchPattern":"try { cols = defn.selectPartialTableColumns(table, columns); } catch (IAE e) { cols = table.resolvedTable().spec().columns(); }","preventionTips":["Define the schema in exactly one place: catalog spec or SQL TABLE(...)","Pass null/empty columns when the catalog already has a schema","Avoid copying full specs into both UI and SQL","Review table definitions before adding function-level schemas"],"tags":["druid","catalog","columns","duplicate-definition"],"backgroundTag":"conflicting-config-options","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}