{"record":{"id":"260c42e3fd9792a0","repo":"apache/druid","slug":"not-implemented-260c42","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/Bitmap64ExactCountMergeBufferAggregator.java","lineNumber":67,"sourceCode":"  {\n    Object x = selector.getObject();\n    if (x == null) {\n      return;\n    }\n    Bitmap64 bitmap64Counter = counterCache.get(buf).get(position);\n    bitmap64Counter.fold((RoaringBitmap64Counter) x);\n  }\n\n  @Override\n  public Object get(ByteBuffer buf, int position)\n  {\n    return counterCache.get(buf).get(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    counterCache.clear();","sourceCodeStart":49,"sourceCodeEnd":85,"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/Bitmap64ExactCountMergeBufferAggregator.java#L49-L85","documentation":"Bitmap64ExactCountMergeBufferAggregator.getLong(ByteBuffer, int) is an intentionally unimplemented stub. The merge buffer aggregator maintains an underlying counter object per slot (counterCache) whose cardinality is exposed through its own accessor; getLong() on the buffer aggregator itself is not supported and always throws UnsupportedOperationException(\"Not implemented\").","triggerScenarios":"Finalization calls bufferAggregator.getLong(buf, position) on the bitmap64 merge aggregation slot — e.g. generic group-by/timeseries result readers or post-aggregators typed LONG reading the slot directly.","commonSituations":"Custom query engines reading aggregation slots with getLong by default; tests enumerating BufferAggregator accessors; code ported from other aggregators (long sum) that assumes getLong works for all buffer aggregators.","solutions":["Read the counter via get(buf, position) (counterCache.get(buf).get(position)) and take its cardinality accessor.","Consume results through the standard finalization path, which uses the counter object's own accessor rather than BufferAggregator.getLong.","Adjust post-aggregator/input-type declarations so the merge aggregation isn't read via getLong.","Implement getLong() in the extension delegating to the counter value if direct access is required."],"exampleFix":"// before\nlong v = bufferAggregator.getLong(buf, position);\n\n// after\nObject counter = bufferAggregator.get(buf, position);\nlong v = (counter instanceof Number) ? ((Number) counter).longValue() : 0L;","handlingStrategy":"type-guard","validationCode":"Object c = bufferAggregator.get(buf, position); boolean ok = c instanceof Number || c instanceof Roaring64Bitmap; // read accordingly","typeGuard":"boolean isCounterSlot(BufferAggregator agg, ByteBuffer buf, int pos) { return agg.get(buf, pos) instanceof Number; }","tryCatchPattern":"try { v = bufferAggregator.getLong(buf, position); } catch (UnsupportedOperationException e) { v = ((Number) bufferAggregator.get(buf, position)).longValue(); }","preventionTips":["Read merge slots via get(buf, position) (counterCache-backed) instead of getLong","Keep the aggregation output type LONG in query specs","Use standard engine finalization rather than direct BufferAggregator getters"],"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"}