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: Optimisation fixes for conjunction merges (#50703) #50933

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Jan 13, 2020

  • SQL: Optimisation fixes for conjunction merges

This commit fixes the following issues around the way comparisions are
merged with ranges in conjunctions:

  • the decision to include the equality of the lower limit is corrected;
  • the selection of the upper limit is corrected to use the upper bound
    of the range;
  • the list of terms in the conjunction is sorted to have the ranges at
    the bottom; this allows subsequent binary comarisions to find compatible
    ranges and potentially be merged away. The end guarantee being that the
    optimisation takes place irrespective of the order of the conjunction
    terms in the statement.

Some comments are also corrected.

  • adress review observation on anon. comparator

Replace anonymous comparator of split AND Expressions with a lambda.

(cherry picked from commit 9828cb1)

* SQL: Optimisation fixes for conjunction merges

This commit fixes the following issues around the way comparisions are
merged with ranges in conjunctions:
* the decision to include the equality of the lower limit is corrected;
* the selection of the upper limit is corrected to use the upper bound
of the range;
* the list of terms in the conjunction is sorted to have the ranges at
the bottom; this allows subsequent binary comarisions to find compatible
ranges and potentially be merged away. The end guarantee being that the
optimisation takes place irrespective of the order of the conjunction
terms in the statement.

Some comments are also corrected.

* adress review observation on anon. comparator

Replace anonymous comparator of split AND Expressions with a lambda.

(cherry picked from commit 9828cb1)
@bpintea bpintea merged commit f04b4cb into elastic:7.x Jan 13, 2020
@elasticmachine
Copy link
Collaborator

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

@bpintea bpintea deleted the port/7.x_50703 branch January 13, 2020 20:58
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.

2 participants