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

Optimize BETWEEN predicate in SortedPositionLinks #14598

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WinkerDu
Copy link

@WinkerDu WinkerDu commented Oct 12, 2022

Description

visitBetweenPredicate in SortExpressionVisitor can only handle one side of BETWEEN (GREATER_THAN_OR_EQUAL or LESS_THAN_OR_EQUAL), this pr optimize it and let it handle both sides of BETWEEN as conjunct expressions
Fixes #12096

Documentation

(x) Sufficient documentation is included in this PR.

Release notes

(x) Release notes are required, please propose a release note for me.

# Performance
* Optimize BETWEEN predicate in SortedPositionLinks, let it handle both sides of BETWEEN as conjunct expressions. ({issue}`12096`)

@cla-bot
Copy link

cla-bot bot commented Oct 12, 2022

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: duripeng.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

Change-Id: Ifb4434a1babe9205461492a3572f6ec4aa6368cd
@WinkerDu WinkerDu force-pushed the SortedPositionLink-for-between-join branch from feb32c1 to 17911aa Compare October 12, 2022 18:00
@cla-bot
Copy link

cla-bot bot commented Oct 12, 2022

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@sopel39
Copy link
Member

sopel39 commented Nov 3, 2022

@WinkerDu could you file CLA?

Copy link
Member

@sopel39 sopel39 left a comment

Choose a reason for hiding this comment

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

lgtm % comments

@@ -24,6 +24,7 @@
import io.trino.sql.tree.Node;
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a change description instead of Change-Id: Ifb4434a1babe9205461492a3572f6ec4aa6368cd

@@ -93,7 +95,7 @@ private static SortExpressionContext merge(SortExpressionContext left, SortExpre
}

private static class SortExpressionVisitor
extends AstVisitor<Optional<SortExpressionContext>, Void>
extends AstVisitor<Optional<List<SortExpressionContext>>, Void>
Copy link
Member

Choose a reason for hiding this comment

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

Just List is sufficient. We don't need to wrap it in Optional anymore

@@ -120,7 +122,7 @@ protected Optional<SortExpressionContext> visitComparisonExpression(ComparisonEx
hasBuildReferencesOnOtherSide = hasBuildSymbolReference(buildSymbols, comparison.getRight());
}
if (sortChannel.isPresent() && !hasBuildReferencesOnOtherSide) {
yield sortChannel.map(symbolReference -> new SortExpressionContext(symbolReference, singletonList(comparison)));
yield sortChannel.map(symbolReference -> singletonList(new SortExpressionContext(symbolReference, singletonList(comparison))));
Copy link
Member

Choose a reason for hiding this comment

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

use ImmutableList.of()

@WinkerDu
Copy link
Author

WinkerDu commented Nov 9, 2022

@sopel39 Thanks for the CR, I've receive CLA reply yesterday, will push a new commit soon

@sopel39
Copy link
Member

sopel39 commented Jan 3, 2023

@sopel39 Thanks for the CR, I've receive CLA reply yesterday, will push a new commit soon

@WinkerDu are you still working on this?

@sopel39
Copy link
Member

sopel39 commented Apr 26, 2023

@WinkerDu are you still working on this?

@mosabua
Copy link
Member

mosabua commented Jan 12, 2024

👋 @WinkerDu - this PR has become inactive. We hope you are still interested in working on it. Please let us know, and we can try to get reviewers to help with that.

We're working on closing out old and inactive PRs, so if you're too busy or this has too many merge conflicts to be worth picking back up, we'll be making another pass to close it out in a few weeks.

Alternatively @sopel39 did you want to check and run with this if necessary?

@sopel39
Copy link
Member

sopel39 commented Jan 12, 2024

Alternatively @sopel39 did you want to check and run with this if necessary?

We should land this PR, but it needs minor tweaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Use SortedPositionLink for BETWEEN joins
3 participants