apache/druid · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

HllSketchBuildBufferAggregator.getFloat (buffered/vectorized variant) unconditionally throws UnsupportedOperationException because the sketch aggregator's result is a complex sketch, never a float. It is hit when the engine finalizes this buffer aggregator's slot as a FLOAT value.

Source

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

    updater.update(() -> helper.getSketchAtPosition(buf, position));
  }

  @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");
  }

  /**
   * In very rare cases sketches can exceed given memory, request on-heap memory and move there.
   * We need to identify such sketches and reuse the same objects as opposed to wrapping new memory regions.
   */
  @Override
  public void relocate(final int oldPosition, final int newPosition, final ByteBuffer oldBuf, final ByteBuffer newBuf)
  {
    helper.relocate(oldPosition, newPosition, oldBuf, newBuf);
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Finalize the sketch with HLLSketchToCount post-aggregator instead of numeric coercion.
  2. Use SQL APPROX_COUNT_DISTINCT_DS_HLL to obtain counts.
  3. Replace the aggregator with a numeric one if numeric aggregation was intended.
Defensive patterns

Strategy: validation

Validate before calling

if (agg.getType().startsWith("HLLSketch")) { requireSketchFinalizer(postAggregator); }

Type guard

boolean numeric = agg.getType() instanceof String t && !t.contains("Sketch");

Try / catch

try { bufAggregator.getFloat(buf, pos); } catch (UnsupportedOperationException e) { /* finalize via HLLSketchToCount */ }

Prevention

When it happens

Trigger: Vectorized/native queries that coerce the HLLSketchBuild buffer aggregator result to FLOAT, e.g. numeric post-aggregators referencing the sketch aggregator or wrong output-type inference by the query engine.

Common situations: Same as the on-heap variant: numeric post-aggregators applied to sketch aggregators in native JSON queries; SQL queries forcing FLOAT output on a sketch expression.

Related errors


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