Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to #20003 - Convert multiple equality/in-equality on same column joined by Or/Else into SQL IN expression #21476

Closed
wants to merge 3 commits into from

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Jul 1, 2020

Various optimizations to queries with IN:

  • a == X || a == Y -> a IN (X, Y)
  • a != X && a != Y -> a NOT IN (X, Y)
  • a IN (X) -> a == X
  • a IN (X, Y) || a IN (Z, W) -> a IN (X, Y, Z, W)
  • a IN (X, Y, Z) && a IN (Y, Z, W) -> a IN (Y, Z)

Fixes #20003

jonlouie and others added 3 commits June 30, 2020 02:43
create negation unit tests

add parentheses to negated expression on translation

expose unit test to sqlite test suite

add unit tests for negating a column and LIKE expression

use RequiresBrackets helper

Fixes #13919
…joined by Or/Else into SQL IN expression

Various optimizations to queries with IN:
- a == X || a == Y -> a IN (X, Y)
- a != X && a != Y -> a NOT IN (X, Y)
- a IN (X) -> a == X
- a IN (X, Y) || a IN (Z, W) -> a IN (X, Y, Z, W)
- a IN (X, Y, Z) && a IN (Y, Z, W) -> a IN (Y, Z)

Fixes #20003
@maumar maumar requested review from smitpatel and roji July 1, 2020 04:10
caseComponent);
}

var left = (SqlExpression)Visit(sqlBinaryExpression.Left);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the part that was added

@maumar maumar closed this Jul 1, 2020
@maumar maumar deleted the fix20003 branch July 1, 2020 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert multiple equality/in-equality on same column joined by Or/Else into SQL IN expression
2 participants