GitHub user StevenMPhillips opened a pull request:
https://github.com/apache/drill/pull/189
DRILL-3912: Common subexpression elimination
In EvaluationVisitor, map each logical expression subtree to the
HoldingContainer produced when the subtree is evaluated, and store it in a
HashMap.
Tow new classes, HashVisitor and EqualityVisitor are used to determine the
hashcode and equality for the map. Two logical expression trees are equal if
all child nodes are equal, and the root nodes are the same type and have the
same fields.
Only expressions that are in scope are available in the map. When entering
a new scope, the current map is copied into a new map. The current map is
pushed onto a stack, and the new map becomes the current map. When that scope
is left, the previous map is popped off the stack and becomes the current
scope. Thus previously evaluated expression in the outer scope are available
while in the inner scope, but any new expressions will not be available when in
the outer scope.
A new scope is entered when evaluating a boolean expression, or when
evaluating either branch of an If Expression.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/StevenMPhillips/drill drill-3912
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/drill/pull/189.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #189
----
commit f13b4eab7ea1cb61efcda0e137006bc983c9a339
Author: Steven Phillips <[email protected]>
Date: 2015-10-07T10:44:10Z
DRILL-3912: Common subexpression elimination
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---