calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <>
Subject Re: HIVE-9069
Date Mon, 18 May 2015 18:51:21 GMT
The methods that may help are RexUtil.toCnf and RexUtil.pullFactors.

The latter is not as strict, therefore does not cause a combinatorial
explosion in the size of the tree, so is more useful in practice.  They are
tested in RexProgramTest.testCnf and testPullFactors[1] .

These methods canonize at the term level (i.e. “a or b or a” becomes “a or
b” but does not attempt to recognize terms that are equivalent). Neither of
them exploit the symmetry of ‘=‘ (i.e. a = b iff b = a). It would make
sense to normalize comparisons between field references & literals so that
the lower field reference is always on the left. So, "$6 = $3" becomes “$3
= $6”; “$6 > $3” becomes “$3 < $6”. And “literal <= $5” becomes “$5
literal”. This would change a few test logs but would not damage
performance, and would improve a few plans.

Cab you please log a jira case with what you think would be useful even if
you don’t intend to write a patch.



On May 18, 2015, at 11:02 AM, Jesus Camachorodriguez <> wrote:


This is the JIRA case for pushing the expressions from filters down:


Let me know if you think a Calcite method could be applied to simplify
that predicate, or I could extend a method myself to cover those cases.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message