Class AbstractSegmentMetadataCache.FirstTypeMergePolicy

java.lang.Object
org.apache.druid.segment.metadata.AbstractSegmentMetadataCache.FirstTypeMergePolicy
All Implemented Interfaces:
AbstractSegmentMetadataCache.ColumnTypeMergePolicy
Enclosing class:
AbstractSegmentMetadataCache<T extends DataSourceInformation>

public static class AbstractSegmentMetadataCache.FirstTypeMergePolicy extends Object implements AbstractSegmentMetadataCache.ColumnTypeMergePolicy
Classic logic, we use the first type we encounter. This policy is effectively 'newest first' because we iterated segments starting from the most recent time chunk, so this typically results in the most recently used type being chosen, at least for systems that are continuously updated with 'current' data. Since AbstractSegmentMetadataCache.ColumnTypeMergePolicy are used to compute the SQL schema, at least in systems using SQL schemas which are partially or fully computed by this cache, this merge policy can result in query time errors if incompatible types are mixed if the chosen type is more restrictive than the types of some segments. If data is likely to vary in type across segments, consider using AbstractSegmentMetadataCache.LeastRestrictiveTypeMergePolicy instead.