julianhyde/optiq — pull request #235 by vlsi (2014-04-06 20:21:48+00:00)
Title: Use separate variables for "expr != null" conditions. This allows to reu...

...se the result of expr calculation

This is a basic reuse of expressions that might duplicate out of "null-checks".
For instance: `upper(udf(1))` is typically translated to `udf(1) == null ? null : upper(udf(1))`
The fix parttern-matches `XXX == null` and factors `XXX` to separate declaration.
Thus final expression becomes `v0 = udf(1); v1 = v0 == null ? null : upper(v0)`

The fix requires equals/hashCode support from linq4j: https://github.com/julianhyde/linq4j/pull/12