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

expression: Add TIDB_PARSE_TSO_LOGICAL() function #46452

Merged
merged 4 commits into from
Sep 4, 2023

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Aug 28, 2023

What problem does this PR solve?

Issue Number: close #46451

Problem Summary:

What is changed and how it works?

This PR adds a TIDB_PARSE_TSO_LOGICAL() function.

sql> SET @ts := 443852055297916932;
Query OK, 0 rows affected (0.0007 sec)

sql> SELECT TIDB_PARSE_TSO(@ts);
+----------------------------+
| TIDB_PARSE_TSO(@ts)        |
+----------------------------+
| 2023-08-27 20:33:41.687000 |
+----------------------------+
1 row in set (0.0010 sec)

sql> SELECT FROM_UNIXTIME((@ts>>18)/1000);
+-------------------------------+
| FROM_UNIXTIME((@ts>>18)/1000) |
+-------------------------------+
| 2023-08-27 20:33:41.6870      |
+-------------------------------+
1 row in set (0.0012 sec)

sql> SELECT TIDB_PARSE_TSO_LOGICAL(@ts);
+-----------------------------+
| TIDB_PARSE_TSO_LOGICAL(@ts) |
+-----------------------------+
|                           4 |
+-----------------------------+
1 row in set (0.0010 sec)

sql> SELECT @ts-((@ts>>18)<<18);
+---------------------+
| @ts-((@ts>>18)<<18) |
+---------------------+
|                   4 |
+---------------------+
1 row in set (0.0011 sec)

sql> \! tiup ctl:v7.3.0 pd tso 443852055297916932
Starting component `ctl`: /home/dvaneeden/.tiup/components/ctl/v7.3.0/ctl pd tso 443852055297916932
system:  2023-08-27 20:33:41.687 +0200 CEST
logic:   4

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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.

A `TIDB_PARSE_TSO_LOGICAL()` function was added to allow the extraction of the logical part of the TSO timestamp.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 28, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 28, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 28, 2023
@tiprow
Copy link

tiprow bot commented Aug 28, 2023

Hi @dveeden. 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/test-infra repository.

@dveeden
Copy link
Contributor Author

dveeden commented Aug 28, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Aug 28, 2023
@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Merging #46452 (85eb5fa) into master (587eacf) will decrease coverage by 0.6980%.
The diff coverage is 52.3809%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46452        +/-   ##
================================================
- Coverage   73.3528%   72.6549%   -0.6980%     
================================================
  Files          1314       1335        +21     
  Lines        395386     401630      +6244     
================================================
+ Hits         290027     291804      +1777     
- Misses        86897      91303      +4406     
- Partials      18462      18523        +61     
Flag Coverage Δ
integration 25.3545% <0.0000%> (?)
unit 73.3467% <52.3809%> (-0.0062%) ⬇️

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

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 84.9628% <ø> (+0.0108%) ⬆️
br 47.9837% <ø> (-4.3221%) ⬇️

@dveeden
Copy link
Contributor Author

dveeden commented Aug 28, 2023

/test all

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 28, 2023
@dveeden dveeden marked this pull request as ready for review August 28, 2023 14:21
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 28, 2023
@dveeden dveeden added the sig/sql-infra SIG: SQL Infra label Aug 28, 2023
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 29, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 31, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JmPotato, wjhuang2016

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 31, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 31, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-29 03:16:28.0923148 +0000 UTC m=+1810552.641330781: ☑️ agreed by JmPotato.
  • 2023-08-31 08:21:33.262652902 +0000 UTC m=+2001657.811668890: ☑️ agreed by wjhuang2016.

@JmPotato
Copy link
Member

/test unit-test

@tiprow
Copy link

tiprow bot commented Aug 31, 2023

@JmPotato: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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/test-infra repository.

@hawkingrei
Copy link
Member

/test all

1 similar comment
@hawkingrei
Copy link
Member

/test all

@dveeden
Copy link
Contributor Author

dveeden commented Sep 4, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@dveeden: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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/test-infra repository.

@dveeden
Copy link
Contributor Author

dveeden commented Sep 4, 2023

/retest

@dveeden
Copy link
Contributor Author

dveeden commented Sep 4, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@dveeden: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit 302786f into pingcap:master Sep 4, 2023
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/sql-infra SIG: SQL Infra size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The TIDB_PARSE_TSO() function only extracts the physical part not the logical part
4 participants