apache/druid · error · java.lang.UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

SketchBufferAggregator maintains a theta sketch Union in the aggregation buffer and exposes results only through get(); getFloat() is an intentionally unsupported sentinel that always throws UnsupportedOperationException. It fires if a query or caller attempts to read the sketch metric via the primitive float accessor, which has no defined meaning for a sketch.

Source

Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchBufferAggregator.java:70

      return;
    }

    Union union = helper.getOrCreateUnion(buf, position);
    SketchAggregator.updateUnion(union, update);
  }


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

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

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

  @Override
  public double getDouble(ByteBuffer buf, int position)
  {
    throw new UnsupportedOperationException("Not implemented");
  }

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

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Read the sketch through get() and finalize it with SketchEstimateOrDefaultPostAggregator or similar post-aggregators
  2. Avoid configuring this aggregator as a float-typed metric in queries or downstream tooling

Example fix

// before
float f = bufferAggregator.getFloat(buf, pos);
// after
Object sketch = bufferAggregator.get(buf, pos);
Defensive patterns

Strategy: validation

Validate before calling

if (bufferAgg instanceof SketchBufferAggregator && "float".equals(outputType)) { throw new IllegalArgumentException("FLOAT output unsupported for thetaSketch buffer aggregation"); }

Type guard

boolean readableAsFloat(BufferAggregator a) { return !(a instanceof SketchBufferAggregator); }

Try / catch

try { f = agg.getFloat(buf, pos); } catch (UnsupportedOperationException e) { f = 0f; /* route through get() + sketch post-aggregator */ }

Prevention

When it happens

Trigger: A query with FLOAT output type or float numeric accessor runs against a theta sketch metric using the buffer (vectorized/byte-buffer) aggregation path.

Common situations: outputType FLOAT on thetaSketch aggregators; generic buffer-aggregator iteration in custom code; SQL planner mapping a sketch expression to FLOAT.

Related errors


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