{"record":{"id":"084ca707828f8533","repo":"apache/druid","slug":"cannot-convert-object-to-float","errorCode":null,"errorMessage":"Cannot convert object to float","messagePattern":"Cannot convert object to float","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/UnnestColumnValueSelectorCursor.java","lineNumber":159,"sourceCode":"              return 0;\n            }\n            if (value instanceof Number) {\n              return ((Number) value).doubleValue();\n            }\n            throw new UOE(\"Cannot convert object to double\");\n          }\n\n          @Override\n          public float getFloat()\n          {\n            Object value = getObject();\n            if (value == null) {\n              return 0;\n            }\n            if (value instanceof Number) {\n              return ((Number) value).floatValue();\n            }\n            throw new UOE(\"Cannot convert object to float\");\n          }\n\n          @Override\n          public long getLong()\n          {\n            Object value = getObject();\n            if (value == null) {\n              return 0;\n            }\n            if (value instanceof Number) {\n              return ((Number) value).longValue();\n            }\n            throw new UOE(\"Cannot convert object to long\");\n          }\n\n          @Override\n          public void inspectRuntimeShape(RuntimeShapeInspector inspector)\n          {","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/UnnestColumnValueSelectorCursor.java#L141-L177","documentation":"Runtime type guard in the unnest cursor's column value selector: when the unnested cell value is neither null nor a Number (e.g. it is a String or other object), the selector cannot fulfill a primitive-float read and raises this error. It fires when a query reads an unnested column as FLOAT while the actual unnested values are non-numeric; fix by unnesting/coercing values to numbers or selecting the column with a compatible type (string/object).","triggerScenarios":"getFloat() called on an UnnestColumnValueSelectorCursor whose underlying getObject() returns a non-Number object (string, map, list, complex).","commonSituations":"FLOAT aggregations over an unnested column that actually holds strings or objects; schema drift where a segment was written with a different type than the query assumes.","solutions":["Coerce column values to numeric before unnesting","Verify segment schema with segment metadata query and fix the column type at ingestion","Change the query to use string handling (e.g. CAST in SQL) instead of float selectors"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"Object v = selector.getObject();\nif (!(v instanceof Number) && v != null) { /* route to string/cast handling */ }","typeGuard":"static boolean isFloatSafe(Object o) { return o == null || o instanceof Number; }","tryCatchPattern":"try { float f = selector.getFloat(); } catch (UOE e) { /* fallback: parse Object as float */ }","preventionTips":["Confirm the unnest source column is numeric-typed","Normalize values to numbers during ingestion","Prefer SQL-level casts over raw object selectors"],"tags":["druid","unnest","type-mismatch"],"backgroundTag":"type-mismatch","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"}