Interface FilterPushDownListener.ScanPushDownListener

Enclosing interface:
FilterPushDownListener

public static interface FilterPushDownListener.ScanPushDownListener
Listener for a one specific group scan.
  • Method Summary

    Modifier and Type
    Method
    Description
    accept(ExprNode conjunct)
    Determine if the given relational operator (which is already in the form <col name> <relop> <const>, qualifies for push down for this scan.
    org.apache.calcite.util.Pair<GroupScan,List<org.apache.calcite.rex.RexNode>>
    Transform a normalized DNF term into a new scan.
  • Method Details

    • accept

      ExprNode accept(ExprNode conjunct)
      Determine if the given relational operator (which is already in the form <col name> <relop> <const>, qualifies for push down for this scan.

      If so, return an equivalent RelOp with the value normalized to what the plugin needs. The returned value may be the same as the original one if the value is already normalized.

      Parameters:
      conjunct - condensed form of a Drill WHERE clause expression node
      Returns:
      a normalized RelOp if this relop can be transformed into a filter push-down, @{code null} if not and thus the relop should remain in the Drill plan
    • transform

      org.apache.calcite.util.Pair<GroupScan,List<org.apache.calcite.rex.RexNode>> transform(ExprNode.AndNode expr)
      Transform a normalized DNF term into a new scan. Normalized form is:
       (a AND b AND (x OR y))

      In which each OR term represents a scan partition. It is up to the code here to determine if the scan partition can be handled, corresponds to a storage partition, or can be done as a separate scan (as for a JDBC or REST plugin, say.)

      Each term is accompanied by the Calcite expression from which it was derived. The caller is responsible for determining which expressions, if any, to leave in the query by returning a list AND'ed (CNF) terms to leave in the query. Those terms can be the ones passed in, or new terms to handle special needs.

      Parameters:
      expr - a set of AND'ed expressions in Conjunctive Normal Form (CNF)
      Returns:
      a pair of elements: a new scan (that represents the pushed filters), and the original or new expression to appear in the WHERE clause joined by AND with any non-candidate expressions. That is, if analysis determines that the plugin can't handle (or cannot completely handle) a term, return the Calcite node for that term back as part of the return value and it will be left in the query. Any Calcite nodes not returned are removed from the query and it is the scan's responsibility to handle them. Either the group scan or the list of Calcite nodes must be non-null. Or, return null if the filter condition can't be handled and the query should remain unchanged.