{"record":{"id":"3502833b50ba977f","repo":"apache/druid","slug":"don-t-know-how-to-handle-type-s","errorCode":null,"errorMessage":"Don't know how to handle type[%s]","messagePattern":"Don't know how to handle type\\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java","lineNumber":157,"sourceCode":"    );\n\n    class IncrementalIndexInputRowColumnSelectorFactory implements ColumnSelectorFactory\n    {\n      @Override\n      public ColumnValueSelector<?> makeColumnValueSelector(final String column)\n      {\n        final ColumnValueSelector selector = baseSelectorFactory.makeColumnValueSelector(column);\n\n        if (agg == null || !agg.getIntermediateType().is(ValueType.COMPLEX)) {\n          return selector;\n        } else {\n          // Wrap selector in a special one that uses ComplexMetricSerde to modify incoming objects.\n          // For complex aggregators that read from multiple columns, we wrap all of them. This is not ideal but it\n          // has worked so far.\n          final String complexTypeName = agg.getIntermediateType().getComplexTypeName();\n          final ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(complexTypeName);\n          if (serde == null) {\n            throw new ISE(\"Don't know how to handle type[%s]\", complexTypeName);\n          }\n\n          final ComplexMetricExtractor extractor = serde.getExtractor();\n          return new ColumnValueSelector()\n          {\n            @Override\n            public boolean isNull()\n            {\n              return selector.isNull();\n            }\n\n            @Override\n            public long getLong()\n            {\n              return selector.getLong();\n            }\n\n            @Override","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java#L139-L175","documentation":"IncrementalIndex.makeColumnValueSelector throws IllegalStateException when an aggregator's intermediate complex type has no registered ComplexMetricSerde (ComplexMetrics.getSerdeForType returned null). Complex metrics (e.g. hyperUnique, sketches) require a serde registered in ComplexMetrics; an unregistered type means Druid cannot extract values for that aggregator.","triggerScenarios":"Querying an IncrementalIndex with a complex aggregator whose intermediateType complex name (e.g. 'hyperUnique', 'quantilesDoublesSketch') was never registered via ComplexMetrics.registerSerde, typically because the extension providing the serde is not loaded.","commonSituations":"Missing druid-(hyperUnique/datasketches) extension in the runtime classpath; query referencing a metric type from an extension not loaded on the node; custom aggregator whose serde was never registered in unit tests.","solutions":["Load the extension providing the serde (add it to druid.extensions.loadList)","Verify ComplexMetrics.getSerdeForType(name) returns non-null before building the index/query","Register the serde manually in tests: ComplexMetrics.registerSerde(name, serde)"],"exampleFix":"// before\n// extension 'druid-datasketches' not loaded; serde for \"quantilesDoublesSketch\" is null\n// after\n// in runtime.properties: druid.extensions.loadList=[\"druid-datasketches\"]\n// or in test setup:\nComplexMetrics.registerSerde(\"quantilesDoublesSketch\", new QuantilesDoublesSketchSerde());","handlingStrategy":"validation","validationCode":"String t = agg.getIntermediateType().getComplexTypeName(); if (ComplexMetrics.getSerdeForType(t) == null) { throw new IllegalStateException(\"Complex metric serde not registered for \" + t + \"; load the providing extension\"); }","typeGuard":null,"tryCatchPattern":"try { selector = index.makeColumnValueSelector(...); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Don't know how to handle type\")) { throw new QueryUnsupportedException(\"missing extension for complex metric\", e); } throw e; }","preventionTips":["Add all sketch/hyperUnique extensions to druid.extensions.loadList on every node","Register serdes in test setup when exercising complex aggregators","Validate aggregator types against loaded extensions at startup"],"tags":["java","ingestion","complex-metric","extension"],"backgroundTag":"missing-dependency","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}