Interface FilterPushdownSupport
Inspired by Lucene's translatable() pattern and Spark's SupportsPushDownFilters,
this interface allows data sources to indicate which ESQL filter expressions they can handle
natively, enabling efficient predicate pushdown.
The pushdown flow works as follows:
- The optimizer calls
pushFilters(List)with AND-separated filter expressions - The implementation converts supported expressions to source-specific filters
- The result contains an opaque pushed filter and any remainder expressions
- The pushed filter is stored in the physical plan node (opaque to core)
- During execution, the operator factory retrieves and applies the pushed filter
Since external sources execute on the coordinator only (ExecutesOn.Coordinator),
the pushed filter is never serialized - it's created during local physical optimization
and consumed immediately by the operator factory in the same JVM.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumIndicates whether an expression can be pushed to the data source.static final recordResult of attempting to push filters to a data source. -
Method Summary
Modifier and TypeMethodDescriptioncanPush(Expression expr) Check if a single expression can be pushed to the source.pushFilters(List<Expression> filters) Attempt to push filters to the source.
-
Method Details
-
pushFilters
Attempt to push filters to the source.The implementation should examine each expression and determine if it can be converted to a source-specific filter. Expressions that can be fully pushed should be converted; those that cannot should be returned as remainder.
- Parameters:
filters- ESQL filter expressions (AND-separated)- Returns:
- result containing the pushed filter (opaque) and remainder expressions
-
canPush
Check if a single expression can be pushed to the source.Similar to Lucene's
translatable()returning YES/NO/RECHECK, this method allows fine-grained control over which expressions are pushable.- Parameters:
expr- the expression to check- Returns:
- the pushability status
-