Class NotFilter

java.lang.Object
org.apache.druid.segment.filter.NotFilter
All Implemented Interfaces:
BooleanUnaryFilter, Filter

public class NotFilter extends Object implements BooleanUnaryFilter
Nice filter you have there... NOT!

This filter inverts the includeUnknown flag to properly ap Druids native two-valued logic (true, false) to SQL three-valued logic (true, false, unknown). At the top level, this flag is always passed in as 'false', and is only flipped by this filter. Other logical filters (AndFilter and OrFilter) propagate the value of includeUnknown to their children.

For example, if the base filter is equality, by default value matchers and indexes only return true for the rows that are equal to the value. When wrapped in a not filter, the not filter indicates that the equality matchers and indexes should also include the null or 'unknown' values as matches, so that inverting the match does not incorrectly include these null values as matches.