apache/druid · error · UnsupportedOperationException

Reverse lookup not allowed.

Error message

Reverse lookup not allowed.

What it means

CompressedVSizeColumnarMultiIntsSupplier's inner UnsharedIndexedInts deliberately rejects reverse lookups. Given a value, indexOf() would have to scan every row to find the offset list matching it, which the compressed column format does not support. Any call to indexOf on this column type throws UnsupportedOperationException.

Solutions

  1. Do not call indexOf on this column type; iterate rows with iterator() or get() instead
  2. Restructure the query to forward-look up values by row index rather than reverse-locating a value
  3. If reverse lookup is required, use a column encoding that supports it (e.g. dictionary-encoded single-value columns)

Example fix

// before
int idx = indexedInts.indexOf(values);
// after
int idx = -1;
for (int i = 0; i < indexedInts.size(); i++) {
  if (indexedInts.get(i).equals(values)) { idx = i; break; }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (indexed instanceof IndexedInts && indexed.size() >= 0 && !supportsReverseLookup) { /* iterate instead */ }

Type guard

boolean supportsReverseLookup(Object col) {
  return !(col instanceof org.apache.druid.segment.data.CompressedVSizeColumnarMultiIntsSupplier.UnsharedIndexedInts);
}

Try / catch

try {
  idx = indexedInts.indexOf(values);
} catch (UnsupportedOperationException e) {
  // fall back to linear scan via iterator()
}

Prevention

When it happens

Trigger: Calling indexOf(IndexedInts) on an IndexedInts supplier returned by a compressed vSize multi-value column, e.g. via column lookup APIs that attempt a reverse lookup.

Common situations: Running filter or lookup code that assumes all IndexedInts columns support indexOf (uncompressed or single-value columns often do); using dictionary-encoded reverse lookup paths against compressed multi-value columns.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/data/CompressedVSizeColumnarMultiIntsSupplier.java:228

            throw new IAE("Index[%d] >= size[%d]", index, size);
          }
          return values.get(index + offset);
        }

        @Override
        public void inspectRuntimeShape(RuntimeShapeInspector inspector)
        {
          inspector.visit("values", values);
        }
      }

      return new UnsharedIndexedInts();
    }

    @Override
    public int indexOf(IndexedInts value)
    {
      throw new UnsupportedOperationException("Reverse lookup not allowed.");
    }

    @Override
    public Iterator<IndexedInts> iterator()
    {
      return IndexedIterable.create(this).iterator();
    }

    @Override
    public void inspectRuntimeShape(RuntimeShapeInspector inspector)
    {
      inspector.visit("offsets", offsets);
      inspector.visit("values", values);
    }
  }

}

View on GitHub (pinned to 9b90983fd2)