Apache Drill
  1. Apache Drill
  2. DRILL-1044

Optimize logical boolean operator evaluation using fast-success/fast-fail approach.

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Component/s: None
    • Labels:
      None

      Description

      With short circuit evaluation supported for boolean and/or operators (DRILL-937), we could further optimize boolean and/or operators by re-ordering the evaluation sequence and choose to evaluate the cheapest test first.

      For instance, consider we have the following expression :

      really_slow_test ( ...) && slower_test ( ...) && fast_test ( ...)

      If we choose to evaluate really_slow_test(() first, we will do such test for every input. In contrast, if we choose do fast_test() first, we could skip the evaluation of slower_test() and really_slow_test(), if some input fails at the fast_test(). That is, performance would be better, if we transform the expression into:

      fast_test(..) && slower_test(...) && really_slow_test (....).

      To add such support, we need do :

      1. Change the boolean "and"/"or" so that it takes arbitrary number of operands. ( Previously, "and"/"or" is processed as taking two operands) This way, we could compare and sort all the operands under one single "and"/"or" operator.

      2. Assign a cost category to different functions/operators, to reflect the rough estimation of each individual function/operator.

      3. Re-order the operands based on the cumulative cost for evaluation.

        Activity

        Jinfeng Ni created issue -
        Jacques Nadeau made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Jacques Nadeau made changes -
        Fix Version/s 0.4.0 [ 12324963 ]
        Tony Stevenson made changes -
        Workflow no-reopen-closed, patch-avail, testing [ 12870786 ] Drill workflow [ 12934260 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Jinfeng Ni
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development