Interface FilterPushDownListener
- All Known Implementing Classes:
GoogleSheetsPushDownListener
,HttpPushDownListener
,SplunkPushDownListener
public interface FilterPushDownListener
Call-back (listener) implementation for a push-down filter.
Abstracts away the common work; plugins implement this class
to do work specific to the plugin.
Supports two kinds of filter push down:
- Conjunctive Normal Form (CNF)
- A series of expressions joined by an AND: the scan should produce only rows that satisfy all the conditions.
- Disjunctive Normal Form (DNF)
- A series of alternative values for a single column, essentially
a set of expressions joined by OR. The scan spits into multiple
scans, each scanning one of the partitions (or regions or
queries) identified by the case. This is an implementation of the
SQL
IN
clause.
In both cases, the conditions are in the form of a
ExprNode.ColRelOpConstNode
in which one side refers to a column in the scan
and the other is a constant expression. The "driver" will ensure
the rel op is of the correct form; this class ensures that the
column is valid for the scan and the type of the value matches the
column type (or can be converted.)
The DNF form further ensures that all rel ops refer to the same column, and that only the equality operator appears in the terms.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Listener for a one specific group scan. -
Method Summary
Modifier and TypeMethodDescriptionbuilderFor
(GroupScan groupScan) Check if the filter rule should be applied to the target group scan, and if so, return the builder to use.boolean
isTargetScan
(GroupScan groupScan) Broad check to see if the scan is of the correct type for this listener.prefix()
-
Method Details
-
prefix
String prefix()- Returns:
- a prefix to display in filter rules
-
isTargetScan
Broad check to see if the scan is of the correct type for this listener. Generally implemented as:public boolean isTargetScan(ScanPrel scan) { return scan.getGroupScan() instanceof MyGroupScan; }
- Parameters:
groupScan
- the scan node- Returns:
- true if the given group scan is one this listener can handle, false otherwise
-
builderFor
Check if the filter rule should be applied to the target group scan, and if so, return the builder to use.Calcite will run this rule multiple times during planning, but the transform only needs to occur once. Allows the group scan to mark in its own way whether the rule has been applied.
- Parameters:
groupScan
- the scan node- Returns:
- builder instance if the push-down should be applied, null otherwise
-