Class TimeSegmentPruner

  • All Implemented Interfaces:
    SegmentPruner

    public class TimeSegmentPruner
    extends Object
    implements SegmentPruner
    The TimeSegmentPruner prunes segments based on their time column start & end time metadata stored in ZK. The pruner supports queries with filter (or nested filter) of EQUALITY and RANGE predicates.
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeSegmentPruner​(org.apache.pinot.spi.config.table.TableConfig tableConfig, org.apache.helix.store.zk.ZkHelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore)  
    • Method Summary

      Modifier and Type Method Description
      void init​(org.apache.helix.model.IdealState idealState, org.apache.helix.model.ExternalView externalView, Set<String> onlineSegments)
      Initializes the segment pruner with the ideal state, external view and online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector).
      void onAssignmentChange​(org.apache.helix.model.IdealState idealState, org.apache.helix.model.ExternalView externalView, Set<String> onlineSegments)
      Processes the segment assignment (ideal state or external view) change based on the given online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector).
      Set<String> prune​(org.apache.pinot.common.request.BrokerRequest brokerRequest, Set<String> segments)
      NOTE: Pruning is done by searching _intervalTree based on request time interval and check if the results are in the input segments.
      void refreshSegment​(String segment)
      Refreshes the metadata for the given segment (called when segment is getting refreshed).
    • Constructor Detail

      • TimeSegmentPruner

        public TimeSegmentPruner​(org.apache.pinot.spi.config.table.TableConfig tableConfig,
                                 org.apache.helix.store.zk.ZkHelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore)
    • Method Detail

      • init

        public void init​(org.apache.helix.model.IdealState idealState,
                         org.apache.helix.model.ExternalView externalView,
                         Set<String> onlineSegments)
        Description copied from interface: SegmentPruner
        Initializes the segment pruner with the ideal state, external view and online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector). Should be called only once before calling other methods.
        Specified by:
        init in interface SegmentPruner
      • onAssignmentChange

        public void onAssignmentChange​(org.apache.helix.model.IdealState idealState,
                                       org.apache.helix.model.ExternalView externalView,
                                       Set<String> onlineSegments)
        Description copied from interface: SegmentPruner
        Processes the segment assignment (ideal state or external view) change based on the given online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector).
        Specified by:
        onAssignmentChange in interface SegmentPruner
      • refreshSegment

        public void refreshSegment​(String segment)
        Description copied from interface: SegmentPruner
        Refreshes the metadata for the given segment (called when segment is getting refreshed).
        Specified by:
        refreshSegment in interface SegmentPruner
      • prune

        public Set<String> prune​(org.apache.pinot.common.request.BrokerRequest brokerRequest,
                                 Set<String> segments)
        NOTE: Pruning is done by searching _intervalTree based on request time interval and check if the results are in the input segments. By doing so we will have run time O(M * logN) (N: # of all online segments, M: # of qualified intersected segments).
        Specified by:
        prune in interface SegmentPruner