processing/src/main/java/org/apache/druid/segment/IndexMergerV9.java
/**
   * Creates a merged columnCapabilities to merge two queryableIndexes.
   * This method first snapshots a pair of capabilities and then merges them.
   */
Creates a merged columnCapabilities to merge two queryableIndexes.
This method first snapshots a pair of capabilities and then merges them.
Creates a merged columnCapabilities to merge two queryableIndexes . This method first snapshots a pair of capabilities and then merges them .
@Nullable
  private static ColumnCapabilitiesImpl mergeCapabilities(
      @Nullable final ColumnCapabilities capabilities,
      @Nullable final ColumnCapabilities other,
      CoercionLogic coercionLogic
  )
  {
    ColumnCapabilitiesImpl merged = ColumnCapabilitiesImpl.snapshot(capabilities, coercionLogic);
    ColumnCapabilitiesImpl otherSnapshot = ColumnCapabilitiesImpl.snapshot(other, coercionLogic);
    if (merged == null) {
      return otherSnapshot;
    } else if (otherSnapshot == null) {
      return merged;
    }
    throwIfTypeNotMatchToMerge(merged, otherSnapshot);
    merged.setDictionaryEncoded(merged.isDictionaryEncoded().or(otherSnapshot.isDictionaryEncoded()).isTrue());
    merged.setHasMultipleValues(merged.hasMultipleValues().or(otherSnapshot.hasMultipleValues()).isTrue());
    merged.setDictionaryValuesSorted(
        merged.areDictionaryValuesSorted().and(otherSnapshot.areDictionaryValuesSorted()).isTrue()
    );
    merged.setDictionaryValuesUnique(
        merged.areDictionaryValuesUnique().and(otherSnapshot.areDictionaryValuesUnique()).isTrue()
    );
    merged.setHasNulls(merged.hasNulls().or(other.hasNulls()).isTrue());
    if (merged.hasBitmapIndexes() != otherSnapshot.hasBitmapIndexes()) {
      merged.setHasBitmapIndexes(false);
    }
    if (merged.hasSpatialIndexes() != otherSnapshot.hasSpatialIndexes()) {
      merged.setHasSpatialIndexes(merged.hasSpatialIndexes() || otherSnapshot.hasSpatialIndexes());
    }
    merged.setFilterable(merged.isFilterable() && otherSnapshot.isFilterable());
    return merged;
  }
@ Nullable private static ColumnCapabilitiesImpl mergeCapabilities ( @ Nullable final ColumnCapabilities capabilities , @ Nullable final ColumnCapabilities other , CoercionLogic coercionLogic ) { ColumnCapabilitiesImpl merged = ColumnCapabilitiesImpl . snapshot ( capabilities , coercionLogic ) ; ColumnCapabilitiesImpl otherSnapshot = ColumnCapabilitiesImpl . snapshot ( other , coercionLogic ) ; if ( merged == null ) { return otherSnapshot ; } else if ( otherSnapshot == null ) { return merged ; } throwIfTypeNotMatchToMerge ( merged , otherSnapshot ) ; merged . setDictionaryEncoded ( merged . isDictionaryEncoded ( ) . or ( otherSnapshot . isDictionaryEncoded ( ) ) . isTrue ( ) ) ; merged . setHasMultipleValues ( merged . hasMultipleValues ( ) . or ( otherSnapshot . hasMultipleValues ( ) ) . isTrue ( ) ) ; merged . setDictionaryValuesSorted ( merged . areDictionaryValuesSorted ( ) . and ( otherSnapshot . areDictionaryValuesSorted ( ) ) . isTrue ( ) ) ; merged . setDictionaryValuesUnique ( merged . areDictionaryValuesUnique ( ) . and ( otherSnapshot . areDictionaryValuesUnique ( ) ) . isTrue ( ) ) ; merged . setHasNulls ( merged . hasNulls ( ) . or ( other . hasNulls ( ) ) . isTrue ( ) ) ; if ( merged . hasBitmapIndexes ( ) != otherSnapshot . hasBitmapIndexes ( ) ) { merged . setHasBitmapIndexes ( false ) ; } if ( merged . hasSpatialIndexes ( ) != otherSnapshot . hasSpatialIndexes ( ) ) { merged . setHasSpatialIndexes ( merged . hasSpatialIndexes ( ) || otherSnapshot . hasSpatialIndexes ( ) ) ; } merged . setFilterable ( merged . isFilterable ( ) && otherSnapshot . isFilterable ( ) ) ; return merged ; }
Creates a merged columnCapabilities to merge two queryableIndexes.
Creates a merged columnCapabilities to merge two queryableIndexes .
// When merging persisted queryableIndexes in the same ingestion job, // all queryableIndexes should have the exact same hasBitmapIndexes flag set which is set in the ingestionSpec. // One exception is null-only columns as they always do NOT have bitmap indexes no matter whether the flag is set // in the ingestionSpec. As a result, the mismatch checked in the if clause below can happen // when one of the columnCapability is from a real column and another is from a null-only column. // See NullColumnPartSerde for how columnCapability is created for null-only columns. // When the mismatch is found, we prefer the flag set in the ingestionSpec over // the columnCapability of null-only columns.