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

SQL: Extend the optimisations for equalities (#50792) #51098

Merged
merged 1 commit into from
Jan 16, 2020

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Jan 16, 2020

  • Extend the optimizations for equalities

This commit supplements the optimisations of equalities in conjunctions
and disjunctions:

  • for conjunctions, the existing optimizations with ranges are extended
    with not-equalities and inequalities; these lead to a fast resolution,
    the conjunction either being evaluate to a FALSE, or the non-equality
    conditions being dropped as superfluous;

  • optimisations for disjunctions are added to be applied against ranges,
    inequalities and not-equalities; these lead to disjunction either
    becoming TRUE or the equality being dropped, either as superfluous or
    merged into a range/inequality.

  • Adress review notes

  • Fix the bug around wrongly optimizing 'a=2 OR a!=?', which only yields
    TRUE for same values in equality and inequality.

  • Var renamings, code style adjustments, comments corrections.

  • Address further review comments. Extend optim.

  • fix a few code comments;
  • extend the Equals OR NotEquals optimitsation (a=2 OR a!=5 -> a!=5);
  • extend the Equals OR Range optimisation on limits equality (a=2 OR
    2<=a<5 -> 2<=a<5);
  • in case an equality is being removed in a conjunction, the rest of
    possible optimisations to test is now skipped.
  • rename one var for better legiblity
  • s/rmEqual/removeEquals

(cherry picked from commit 62e7c6a)

* Extend the optimizations for equalities

This commit supplements the optimisations of equalities in conjunctions
and disjunctions:
* for conjunctions, the existing optimizations with ranges are extended
with not-equalities and inequalities; these lead to a fast resolution,
the conjunction either being evaluate to a FALSE, or the non-equality
conditions being dropped as superfluous;
* optimisations for disjunctions are added to be applied against ranges,
inequalities and not-equalities; these lead to disjunction either
becoming TRUE or the equality being dropped, either as superfluous or
merged into a range/inequality.

* Adress review notes

* Fix the bug around wrongly optimizing 'a=2 OR a!=?', which only yields
TRUE for same values in equality and inequality.
* Var renamings, code style adjustments, comments corrections.

* Address further review comments. Extend optim.

- fix a few code comments;
- extend the Equals OR NotEquals optimitsation (a=2 OR a!=5 -> a!=5);
- extend the Equals OR Range optimisation on limits equality (a=2 OR
  2<=a<5 -> 2<=a<5);
- in case an equality is being removed in a conjunction, the rest of
  possible optimisations to test is now skipped.

* rename one var for better legiblity

- s/rmEqual/removeEquals

(cherry picked from commit 62e7c6a)
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/SQL)

@bpintea bpintea merged commit fb65ef3 into elastic:7.x Jan 16, 2020
@bpintea bpintea deleted the port/7.x_50792 branch January 16, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants