apache/druid · error · ISE

Cannot merge columns of type

Error message

Cannot merge columns of type[%s] and format[%s] with type[%s] and format[%s]

What it means

StringDictionaryEncodedColumnFormat.merge() combines two column format descriptors when merging/mixing segments. This ISE is thrown when the other format's column capabilities say the column is not a STRING — a string dictionary-encoded format can only merge with other string-typed formats. It is raised indirectly via combine/aggregate during segment merging or query processing.

Solutions

  1. Re-ingest the affected segments so the column has a consistent STRING type everywhere
  2. Fix the ingestion spec so the column type is identical across all segments being merged
  3. Verify no segment-merge/compaction job is mixing columns of mismatched types

Example fix

// before
// spec writes "user_id" as string in some segments, long in others, then compaction merges them -> ISE
// after
// normalize the column in the ingestion spec:
"metricsSpec": { "name": "user_id", "type": "string" } // consistent everywhere before merging
Defensive patterns

Strategy: validation

Validate before calling

if (!otherFormat.toColumnCapabilities().is(ValueType.STRING)) {
  throw new IllegalStateException("Refusing merge: non-STRING column fed to string dictionary merge");
}

Type guard

boolean isStringFormat(ColumnFormat other) {
  return other.toColumnCapabilities() != null && other.toColumnCapabilities().is(ValueType.STRING);
}

Try / catch

try {
  ColumnFormat merged = thisFormat.merge(otherFormat, caps);
} catch (ISE e) {
  LOG.warn(e, "Format merge type mismatch; schedule re-ingestion of affected segments");
}

Prevention

When it happens

Trigger: Calling merge() (directly or via combine/aggregate during segment merging) with an otherFormat whose ColumnCapabilities report a non-STRING ValueType, e.g. merging a dictionary-encoded string column descriptor with a numeric or complex column format.

Common situations: Merging segments whose schema for the same column diverged (one wrote it as string, another as long/complex); a buggy ingestion spec writing inconsistent types for one column across incremental persists.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/column/StringDictionaryEncodedColumnFormat.java:125

    if (otherFormat == null) {
      return this;
    }

    if (otherFormat instanceof StringDictionaryEncodedColumnFormat) {
      final StringDictionaryEncodedColumnFormat other = (StringDictionaryEncodedColumnFormat) otherFormat;
      return new StringDictionaryEncodedColumnFormat(
          hasMultipleValues || other.hasMultipleValues,
          hasNulls || other.hasNulls,
          hasBitmapIndexes && other.hasBitmapIndexes,
          hasSpatialIndexes || other.hasSpatialIndexes,
          columnFormatSpec != null ? columnFormatSpec : other.columnFormatSpec
      );
    }

    if (otherFormat instanceof CapabilitiesBasedFormat) {
      final ColumnCapabilities otherCaps = otherFormat.toColumnCapabilities();
      if (!otherCaps.is(ValueType.STRING)) {
        throw new ISE(
            "Cannot merge columns of type[%s] and format[%s] with type[%s] and format[%s]",
            ColumnType.STRING,
            this.getClass().getName(),
            otherFormat.getLogicalType(),
            otherFormat.getClass().getName()
        );
      }
      return new StringDictionaryEncodedColumnFormat(
          hasMultipleValues || otherCaps.hasMultipleValues().isMaybeTrue(),
          hasNulls || otherCaps.hasNulls().isMaybeTrue(),
          hasBitmapIndexes && otherCaps.hasBitmapIndexes(),
          hasSpatialIndexes || otherCaps.hasSpatialIndexes(),
          columnFormatSpec
      );
    }

    throw new ISE(
        "Cannot merge columns of type[%s] and format[%s] and with [%s] and [%s]",

View on GitHub (pinned to 9b90983fd2)