apache/druid · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

HllSketchMergeBufferAggregator supports only getDouble() for numeric reads; getFloat() is explicitly unimplemented because HLL estimates are doubles and float truncation is undesirable. Calling it throws UnsupportedOperationException. Read the estimate with getDouble() or access the sketch directly.

Source

Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchMergeBufferAggregator.java:84

    union.update(sketch.getSketch());
  }

  @Override
  public Object get(final ByteBuffer buf, final int position)
  {
    return HllSketchHolder.of(helper.get(buf, position));
  }

  @Override
  public void close()
  {
    helper.clear();
  }

  @Override
  public float getFloat(final ByteBuffer buf, final int position)
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public long getLong(final ByteBuffer buf, final int position)
  {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public void inspectRuntimeShape(RuntimeShapeInspector inspector)
  {
    inspector.visit("selector", selector);
    // lgK should be inspected because different execution paths exist in Union.update() that is called from
    // @CalledFromHotLoop-annotated aggregate() depending on the lgK.
    // See https://github.com/apache/druid/pull/6893#discussion_r250726028
    inspector.visit("lgK", helper.getLgK());
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Use getDouble(buf, position) instead of getFloat
  2. Type the aggregation as "double"/sketch in the query spec rather than "float"
  3. For finalized values use HllSketchHolder/estimate accessors instead of raw buffer reads

Example fix

// before
float v = agg.getFloat(buf, position);
// after
double v = agg.getDouble(buf, position);
Defensive patterns

Strategy: validation

Try / catch

try { v = agg.getFloat(buf, pos); } catch (UnsupportedOperationException e) { v = (float) agg.getDouble(buf, pos); }

Prevention

When it happens

Trigger: Calling bufferAggregator.getFloat(buf, position), or running a vectorized/query path whose column type is FLOAT over an HLL merge metric.

Common situations: Native queries typed as float over a sketch metric; custom aggregation frameworks reading via float accessors; incorrect intermediateType assumptions in post-aggregation code.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/fc571f5c9584f7fd. Report an issue: GitHub.