SegmentMetadata queries

    Segment metadata queries return per-segment information about:

    • Number of rows stored inside the segment
    • Interval the segment covers
    • Estimated total segment byte size in if it was stored in a ‘flat format’ (e.g. a csv file)
    • Segment id
    • Is the segment rolled up
    • Detailed per column information such as:
      • type
      • cardinality
      • presence of null values
      • estimated ‘flat format’ byte size

    There are several main parts to a segment metadata query:

    The format of the result is:

    Dimension columns will have type , FLOAT, DOUBLE, or LONG. Metric columns will have type FLOAT, DOUBLE, or LONG, or the name of the underlying complex type such as in case of COMPLEX metric. Timestamp column will have type LONG.

    If the errorMessage field is non-null, you should not trust the other fields in the response. Their contents are undefined.

    Only columns which are dictionary encoded (i.e., have type STRING) will have any cardinality. Rest of the columns (timestamp and metric columns) will show cardinality as null.

    The length of this default time period is set in the Broker configuration via: druid.query.segmentMetadata.defaultHistory

    There are 3 types of toInclude objects.

    The grammar is as follows:

    None

    The grammar is as follows:

    List

    The grammar is as follows:

    This is a list of properties that determines the amount of information returned about the columns, i.e. analyses to be performed on the columns.

    The default analysis types can be set in the Broker configuration via: druid.query.segmentMetadata.defaultAnalysisTypes

    Types of column analyses are described below:

    • cardinality in the result will return the size of the bitmap index or dictionary encoding for string dimensions, or null for other dimension types. If was set, the result will be the max of this value across segments. Only relevant for dimension columns.

    minmax

    • Estimated min/max values for each column. Only relevant for dimension columns.

    size

    • size in the result will contain the estimated total segment byte size as if the data were stored in text format
    • intervals in the result will contain the list of intervals associated with the queried segments.

    timestampSpec

    • timestampSpec in the result will contain timestampSpec of data stored in segments. this can be null if timestampSpec of segments was unknown or unmergeable (if merging is enabled).

    queryGranularity

    • queryGranularity in the result will contain query granularity of data stored in segments. this can be null if query granularity of segments was unknown or unmergeable (if merging is enabled).
    • aggregators in the result will contain the list of aggregators usable for querying metric columns. This may be null if the aggregators are unknown or unmergeable (if merging is enabled).

    • Merging can be strict or lenient. See lenientAggregatorMerge below for details.

    • The form of the result is a map of column name to aggregator.

    rollup

    • When merging is enabled, if some are rollup, others are not, result is null.

    Conflicts between aggregator metadata across segments can occur if some segments have unknown aggregators, or if two segments use incompatible aggregators for the same column (e.g. longSum changed to doubleSum).

    In particular, with lenient merging, it is possible for an individual column’s aggregator to be null. This will not occur with strict merging.