Class AllFilter

    • Constructor Detail

      • AllFilter

        public AllFilter()
        Default constructor (necessary for the ExternalizableLite interface).
      • AllFilter

        public AllFilter​(Filter[] afilter)
        Construct an "all" filter. The result is defined as:
        afilter[0] && afilter[1] ... && afilter[n]
        Parameters:
        afilter - an array of filters
    • Method Detail

      • evaluate

        public boolean evaluate​(Object o)
        Apply the test to the input argument.
        Parameters:
        o - the input argument to evaluate
        Returns:
        true if the input argument matches the filter, otherwise false
      • calculateEffectiveness

        public int calculateEffectiveness​(Map mapIndexes,
                                          Set setKeys)
        Given a Map of available indexes, determine if this IndexAwareFilter can use any of the indexes to assist in its processing, and if so, determine how effective the use of that index would be.

        The returned value is an effectiveness estimate of how many keys will remain in the set after the index is applied. If no keys will remain in the set after the index is applied, this method should return 0. If all the keys will remain in the set, implying that no entries would be filtered out based on this filter, this method should return setKeys.size(). Otherwise, it should return the value between 0 and setKeys.size(). If there is no index in the specified index map that can be used by this filter, this method should return a negative integer.

        The effectiveness returned will be used by the composite filters to reorder nested filters from most to least effective, in order to optimize query execution.

        Parameters:
        mapIndexes - the available MapIndex objects keyed by the related ValueExtractor; read-only
        setKeys - the set of keys that will be filtered; read-only
        Returns:
        an effectiveness estimate of how well this filter can use the specified indexes to filter the specified keys
      • evaluateEntry

        protected boolean evaluateEntry​(Map.Entry entry,
                                        QueryContext ctx,
                                        QueryRecord.PartialResult.TraceStep step)
        Check if the given entry passes the filter's evaluation. Record the actual cost of execution for each of the participating filters if a query context is provided.
        Specified by:
        evaluateEntry in class ArrayFilter
        Parameters:
        entry - a key value pair to filter
        ctx - the query ctx; may be null
        step - the step used to record the execution cost
        Returns:
        true if the entry passes the filter, false otherwise
      • simplifyFilters

        protected Set<Filter<?>> simplifyFilters()
        Description copied from class: ArrayFilter
        Simplify internal filter array by merging and replacing filters if possible to reduce the overall number and nesting of the filters.
        Specified by:
        simplifyFilters in class ArrayFilter
        Returns:
        the simplified filter array
      • applyIndex

        protected Filter applyIndex​(Map mapIndexes,
                                    Set setKeys,
                                    QueryContext ctx,
                                    QueryRecord.PartialResult.TraceStep step)
        Description copied from class: ArrayFilter
        Apply the specified IndexAwareFilter to the specified keySet. Record the actual cost of execution for each of the participating filters if a query context is provided.
        Specified by:
        applyIndex in class ArrayFilter
        Parameters:
        mapIndexes - the available MapIndex objects keyed by the related ValueExtractor; read-only
        setKeys - the set of keys that would be filtered
        ctx - the query ctx; may be null
        step - the step used to record the execution cost
        Returns:
        a Filter object that can be used to process the remaining keys, or null if no additional filter processing is necessary