{"record":{"id":"3059cde97071adf6","repo":"apache/druid","slug":"not-implemented-3059cd","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/druid-exact-count-bitmap/src/main/java/org/apache/druid/query/aggregation/exact/count/bitmap64/Bitmap64ExactCountBuildBufferAggregator.java","lineNumber":71,"sourceCode":"      if (!selector.isNull()) {\n        bitmap64Counter.add(selector.getLong());\n      }\n    }\n    finally {\n      buf.position(oldPosition);\n    }\n  }\n\n  @Override\n  public Object get(ByteBuffer buf, int position)\n  {\n    return getOrCreateCollector(buf, position);\n  }\n\n  @Override\n  public long getLong(ByteBuffer buf, int position)\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public double getDouble(ByteBuffer buf, int position)\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public float getFloat(ByteBuffer buf, int position)\n  {\n    throw new UnsupportedOperationException(\"Not implemented\");\n  }\n\n  @Override\n  public void close()\n  {\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/druid-exact-count-bitmap/src/main/java/org/apache/druid/query/aggregation/exact/count/bitmap64/Bitmap64ExactCountBuildBufferAggregator.java#L53-L89","documentation":"Bitmap64ExactCountBuildBufferAggregator.getLong(ByteBuffer, int) is an intentionally unimplemented stub. The off-heap (buffer) variant of the build aggregator stores a serialized Roaring64Bitmap in the aggregation buffer and cannot yield a long scalar, so getLong() always throws UnsupportedOperationException(\"Not implemented\").","triggerScenarios":"Group-by or timeseries engine finalizes a result and calls bufferAggregator.getLong(buf, position) on the bitmap build aggregation slot, e.g. because the aggregation was declared with a LONG output type or generic finalization code reads a long.","commonSituations":"Using the BITMAP64_BUILD_* aggregator where the merge/exact-count type was intended; custom query engines or tests calling getLong directly on buffer aggregators; post-aggregators declared over the build aggregation expecting numeric input.","solutions":["Use the merge/counter aggregation type (whose getLong returns cardinality) in the query instead of the build type.","Read the value via get(buf, position) (returns the bitmap/collector object) and call getLongCardinality() on it.","Fix the query layer/post-aggregator to treat the build aggregation output as an object, not a long.","If this is your fork, implement getLong() delegating to the collector's counter value if appropriate."],"exampleFix":"// before\nlong v = bufferAggregator.getLong(buf, position);\n\n// after\nObject collector = bufferAggregator.get(buf, position);\nlong v = (collector instanceof Roaring64Bitmap)\n    ? ((Roaring64Bitmap) collector).getLongCardinality()\n    : 0L;","handlingStrategy":"type-guard","validationCode":"Object c = bufferAggregator.get(buf, position); boolean ok = c instanceof Roaring64Bitmap; // then read cardinality from c","typeGuard":"boolean isBitmapSlot(BufferAggregator agg, ByteBuffer buf, int pos) { return agg.get(buf, pos) instanceof Roaring64Bitmap; }","tryCatchPattern":"try { v = bufferAggregator.getLong(buf, position); } catch (UnsupportedOperationException e) { v = ((Roaring64Bitmap) bufferAggregator.get(buf, position)).getLongCardinality(); }","preventionTips":["Never call numeric getters on BITMAP64_BUILD_* buffer aggregators","Use get(buf, position) and operate on the bitmap/collector object","Switch to the merge aggregation for numeric results"],"tags":["druid","aggregation","unsupported-operation","buffer"],"backgroundTag":"method-not-implemented","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"}