{"record":{"id":"650b788592d9fb9c","repo":"apache/druid","slug":"missing-type-for-column-s","errorCode":null,"errorMessage":"Missing type for column [%s]","messagePattern":"Missing type for column \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/kernel/StageDefinition.java","lineNumber":143,"sourceCode":"      this.broadcastInputNumbers = (IntSet) broadcastInputNumbers;\n    } else {\n      this.broadcastInputNumbers = new IntAVLTreeSet(broadcastInputNumbers);\n    }\n\n    this.processor = Preconditions.checkNotNull(processor, \"processor\");\n    this.signature = Preconditions.checkNotNull(signature, \"signature\");\n    this.shuffleSpec = shuffleSpec;\n    this.maxWorkerCount = maxWorkerCount;\n    this.shuffleCheckHasMultipleValues = shuffleCheckHasMultipleValues;\n    this.frameReader = Suppliers.memoize(() -> FrameReader.create(signature))::get;\n\n    if (mustGatherResultKeyStatistics() && shuffleSpec.clusterBy().isEmpty()) {\n      throw new IAE(\"Cannot shuffle with spec [%s] and nil clusterBy\", shuffleSpec);\n    }\n\n    for (final String columnName : signature.getColumnNames()) {\n      if (!signature.getColumnType(columnName).isPresent()) {\n        throw new ISE(\"Missing type for column [%s]\", columnName);\n      }\n    }\n\n    for (final int broadcastInputNumber : this.broadcastInputNumbers) {\n      if (broadcastInputNumber < 0 || broadcastInputNumber >= inputSpecs.size()) {\n        throw new ISE(\"Broadcast input number out of range [%s]\", broadcastInputNumber);\n      }\n    }\n  }\n\n  public static boolean mustGatherResultKeyStatistics(@Nullable final ShuffleSpec shuffleSpec)\n  {\n    return shuffleSpec != null\n           && shuffleSpec.kind() == ShuffleKind.GLOBAL_SORT\n           && ((GlobalSortShuffleSpec) shuffleSpec).mustGatherResultKeyStatistics();\n  }\n\n  public static StageDefinitionBuilder builder(final int stageNumber)","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/kernel/StageDefinition.java#L125-L161","documentation":"StageDefinition's constructor verifies that every column in the stage's RowSignature has a known type. If signature.getColumnType(columnName) is empty for any column, the stage is malformed and ISE(\"Missing type for column [%s]\") is thrown. Downstream frame serialization and shuffle logic require fully-typed signatures.","triggerScenarios":"Creating a StageDefinition whose RowSignature contains a column added without a type (e.g. via RowSignature.Builder.add(col) without the type argument, or a column synthesized by a processor that never set its type).","commonSituations":"Custom aggregation/processor extensions appending output columns without declaring their SqlType, or building signatures dynamically from input data where a column's type could not be inferred.","solutions":["Declare the type when building the signature: signatureBuilder.add(columnName, ColumnType.LONG) (or the correct type)","Trace where the named column enters the signature and add its SqlType/ColumnType at that point","Check custom extension processors that produce output columns and ensure they extend the signature with types"],"exampleFix":"// before\nRowSignature.Builder.add(\"cnt\");\n// after\nRowSignature.Builder.add(\"cnt\", ColumnType.LONG);","handlingStrategy":"validation","validationCode":"for (String col : signature.getColumnNames()) {\n  if (!signature.getColumnType(col).isPresent()) {\n    throw new IllegalStateException(\"Column missing type: \" + col);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { StageDefinition def = builder.build(); } catch (IllegalStateException e) { log.error(\"Untyped column in signature: {}\", e.getMessage()); }","preventionTips":["Use RowSignature.Builder.add(name, ColumnType) — never the typeless overload","Have processors declare output column types when they append columns","Assert signature completeness in unit tests for custom processors"],"tags":["msq","schema","row-signature"],"backgroundTag":"schema-validation-failed","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"}