Hi Vineet, This reminds of the discussions in [1,2] and it seems that we maintain code that does similar stuff in more than one places. Is there a way to unify the code and normalize row expressions in a single place?
Best, Stamatis [1] https://lists.apache.org/thread.html/54bf3ed733eb7e725ce3ea397334aad8f1323ead13e450b1753b1521%40%3Cdev.calcite.apache.org%3E [2] https://issues.apache.org/jira/browse/CALCITE-2450 On Sat, Apr 11, 2020 at 12:10 AM Vineet G <[email protected]> wrote: > I believe I found the answer to my question. SubstitutionVisitor already > provides a way to achieve this using canonicalization. It needs to be > improved to consider RexNode of type PLUS. > I have created CALCITE-3194 to add this improvement. > > Thanks, > Vineet > > > On Apr 10, 2020, at 12:00 PM, Vineet G <[email protected]> wrote: > > > > Hi, > > > > I am running into an issue where a materialize view rewriting is not > occurring and the issue is narrowed down to usage of splitFilter. > > > > The problem is in figuring out if two RexNode are equivalent or not. For > simple expressions like (a > 1 AND b < 3) & (b < 3 AND a > 1) it works but > for expressions like (a +b > 1) & (b + a > 1) splitFilter is unable to > figure out that these two expressions are equivalent and as a result it > ends up returning null. > > The reason is that equivalence is determined based on the string > representation of the expressions, since the later two expressions have > different string representation they are deemed inequivalent although they > are semantically equivalent. > > > > Is there better way to figure out semantic equivalence of two rex node > in calcite which may be take commutativity and associativity of operands > into account? > > > > Thanks, > > Vineet Garg > >
