drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jinfeng Ni (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-1044) Optimize logical boolean operator evaluation using fast-success/fast-fail approach.
Date Fri, 20 Jun 2014 00:54:24 GMT
Jinfeng Ni created DRILL-1044:

             Summary: Optimize logical boolean operator evaluation using fast-success/fast-fail
                 Key: DRILL-1044
                 URL: https://issues.apache.org/jira/browse/DRILL-1044
             Project: Apache Drill
          Issue Type: Improvement
            Reporter: Jinfeng Ni

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.


This message was sent by Atlassian JIRA

View raw message