datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

During expression equality, check for new ordering information

Open mustafasrepo opened this issue 1 year ago • 1 comments

Which issue does this PR close?

Closes #.

Rationale for this change

See issue #9812 for rationale.

What changes are included in this PR?

When an equality expression is added to the EquivalenceProperties. In light of this information, we can deduce new information about ordering and constantness. This PR adds this support.

With the PR #9813 we have this support, in terms of behaviour. However, current solution doesn't update state and cannot generalize well.

Are these changes tested?

There is an additional TestCase, that showcases increased coverage with this implementation (That test case fails in main branch).

Are there any user-facing changes?

mustafasrepo avatar May 09 '24 12:05 mustafasrepo

@suremarc, I would appreciate your review if you have time

mustafasrepo avatar May 09 '24 12:05 mustafasrepo

Given this is a fairly small piece of code, two reviewers already took a look and all tests pass, I will go ahead and merge it. If there is any issue we discover later on, or @suremarc points out something we are missing, we will address with a follow-on PR. Thanks all

ozankabak avatar May 10 '24 10:05 ozankabak

Sorry @alamb @mustafasrepo, I completely missed this. My GH notifications tend to get drowned out by stuff from work, but I've discovered my personal email doesn't have this issue. I will check it every day from now on.

As for this PR, looks great and I'm glad we don't have to declare equivalences backwards (f(a) = b) for the sort optimizations to work. I do think the collapse_monotonic_lex_req was a bit of a smell, so it's nice to move that logic closer into the EquivalenceProperties code 👍

suremarc avatar May 14 '24 02:05 suremarc