apache / pinot

Apache Pinot - A realtime distributed OLAP datastore
https://pinot.apache.org/
Apache License 2.0
5.17k stars 1.21k forks source link

Pushdown Not Operator #13085

Open wirybeaver opened 1 week ago

wirybeaver commented 1 week ago

SQL

explain plan for
SELECT id,metadatas FROM rta_m3poc9proportioned WHERE Not (tags_prefixes = 'foo' OR tags_entries = 'bar') AND tags_prefixes = 'foo'  LIMIT 5000
Explain Result Operator Operator_Id Parent_Id
FILTER_INVERTED_INDEX(indexLookUp:inverted_index,operator:EQ,predicate:tags_prefixes = 'foo') 11 6
FILTER_INVERTED_INDEX(indexLookUp:inverted_index,operator:EQ,predicate:tags_entries = 'bar') 10 8
FILTER_INVERTED_INDEX(indexLookUp:inverted_index,operator:EQ,predicate:tags_prefixes = 'foo') 9 8
FILTER_OR 8 7
FILTER_NOT 7 6
FILTER_AND 6 5

Ideally the where clause can be optimized to (NOT tags_prefixes = 'foo') AND (NOT tags_entries = 'bar') AND tags_prefixes = 'foo'

Will work on this later after completing the https://github.com/apache/pinot/issues/13081