apache/druid · error · IllegalArgumentException

unknown encoding strategy : %s

Error message

unknown encoding strategy : %s

What it means

CompressionFactory.getLongSerializer accepts only known long encoding strategies (e.g. auto, delta, table, straight). Any other EncodingStrategy value passed in triggers IllegalArgumentException listing the unsupported strategy name. It is a configuration-validation guard on how long columns are compressed.

Source

Thrown at processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java:388

        return new EntireLayoutColumnarLongsSerializer(
            columnName,
            segmentWriteOutMedium,
            new LongsLongEncodingWriter(order)
        );
      } else {
        return new BlockLayoutColumnarLongsSerializer(
            columnName,
            segmentWriteOutMedium,
            filenameBase,
            order,
            new LongsLongEncodingWriter(order),
            compressionStrategy,
            GenericIndexedWriter.MAX_FILE_SIZE,
            closer
        );
      }
    } else {
      throw new IAE("unknown encoding strategy : %s", encodingStrategy.toString());
    }
  }

  // Float currently does not support any encoding types, and stores values as 4 byte float

  /**
   * Reads a column from a {@link ByteBuffer}, possibly using additional secondary files from a
   * {@link SegmentFileMapper}.
   *
   * @param totalSize  number of rows in the column
   * @param sizePer    number of values per compression buffer, for compressed columns
   * @param fromBuffer primary buffer to read from
   * @param order      byte order
   * @param strategy   compression strategy, for compressed columns
   * @param fileMapper required for reading version 2 (multi-file) indexed. May be null if you know you are reading
   *                   a single-file column. Generally, this should only be null in tests, not production code.
   */
  public static Supplier<ColumnarFloats> getFloatSupplier(

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Fix the longEncoding value in the ingestion spec to a supported strategy: auto, delta, table, or straight
  2. If calling the API directly, pass EncodingStrategy.AUTO or another explicitly supported strategy
  3. Check Druid docs/version for which encoding strategies are valid for long columns in your build

Example fix

// before
"columnConfig": { "longEncoding": "deltas" }
// after
"columnConfig": { "longEncoding": "delta" }
Defensive patterns

Strategy: validation

Validate before calling

Set<String> allowed = Set.of("auto","delta","table","straight");
if (!allowed.contains(spec.getLongEncoding())) { throw new IllegalArgumentException("bad longEncoding"); }

Prevention

When it happens

Trigger: Calling getLongSerializer with an EncodingStrategy instance outside the handled set, typically from a segment writer configured with an invalid longEncoding value.

Common situations: Typo in Druid ingestion spec's columnConfig longEncoding (e.g. "deltas" instead of "delta"); programmatic use of a custom or deprecated encoding strategy not supported for longs.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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