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

planner: Optimized EXTRACT(<UNIT> FROM <partition_column>) for partition pruning. #54209

Merged
merged 10 commits into from
Aug 2, 2024

Conversation

mjonss
Copy link
Contributor

@mjonss mjonss commented Jun 25, 2024

What problem does this PR solve?

Issue Number: close #54210

Problem Summary:
the expression EXTRACT(<time unit> FROM col) is not handled for partition pruning.

What changed and how does it work?

Treat the expression as prunable for all time units except WEEK (due to default_week_format).
Meaning all prunable expressions will work with EQ/col = <date/datetime/time>.
For DATE/DATETIME columns, it also optimizes YEAR and YEAR_MONTH to also work with ranges (<, <=, >, >=, BETWEEN), and for TIME columns it also optimizes HOUR, HOUR_MINUTE, HOUR_SECOND and HOUR_MICROSECOND for ranges.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/invalid-title do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 25, 2024
Copy link

tiprow bot commented Jun 25, 2024

Hi @mjonss. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mjonss mjonss changed the title Optimized EXTRACT(<UNIT> FROM <partition_column>) for partition pruning. planner: Optimized EXTRACT(<UNIT> FROM <partition_column>) for partition pruning. Jun 25, 2024
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 10 lines in your changes missing coverage. Please review.

Project coverage is 75.4003%. Comparing base (8b787f7) to head (78c2aac).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #54209        +/-   ##
================================================
+ Coverage   72.8045%   75.4003%   +2.5958%     
================================================
  Files          1568       1577         +9     
  Lines        439140     473670     +34530     
================================================
+ Hits         319714     357149     +37435     
+ Misses        99744      94858      -4886     
- Partials      19682      21663      +1981     
Flag Coverage Δ
integration 49.6167% <9.4339%> (?)
unit 71.7725% <75.4717%> (-0.0266%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 57.2178% <ø> (+11.3378%) ⬆️

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 9, 2024
@mjonss
Copy link
Contributor Author

mjonss commented Jul 9, 2024

/retest

Copy link

tiprow bot commented Jul 9, 2024

@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mjonss
Copy link
Contributor Author

mjonss commented Jul 9, 2024

/retest

Copy link

tiprow bot commented Jul 9, 2024

@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mjonss mjonss requested review from Defined2014 and winoros July 9, 2024 15:00
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 10, 2024
@mjonss
Copy link
Contributor Author

mjonss commented Jul 11, 2024

/retest

Copy link

tiprow bot commented Jul 11, 2024

@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Defined2014 Defined2014 requested a review from qw4990 July 16, 2024 03:20
Copy link

ti-chi-bot bot commented Aug 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, qw4990

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 2, 2024
Copy link

ti-chi-bot bot commented Aug 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-10 09:12:32.759017457 +0000 UTC m=+435249.994251570: ☑️ agreed by Defined2014.
  • 2024-08-02 09:37:43.041269436 +0000 UTC m=+82260.260031044: ☑️ agreed by qw4990.

Copy link

tiprow bot commented Aug 2, 2024

@mjonss: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tidb_parser_test 3ab5cb1 link true /test tidb_parser_test
fast_test_tiprow 3ab5cb1 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit af962a7 into pingcap:master Aug 2, 2024
21 checks passed
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label Aug 5, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #55178.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EXTRACT(YEAR FROM col) partitioning expression does not prune partitions
4 participants