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: round the frac part for ParseTimeFromFloat64 #56340

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gengliqi
Copy link
Contributor

@gengliqi gengliqi commented Sep 26, 2024

What problem does this PR solve?

Issue Number: close #56339

Problem Summary:
See #56339

What changed and how does it work?

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/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. labels Sep 26, 2024
Copy link

ti-chi-bot bot commented Sep 26, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign charlescheung96 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 26, 2024
Copy link

tiprow bot commented Sep 26, 2024

Hi @gengliqi. 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.

@gengliqi
Copy link
Contributor Author

/check-issue-triage-complete

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.5992%. Comparing base (8c4bab1) to head (142eba3).
Report is 123 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56340         +/-   ##
=================================================
- Coverage   73.4004%   56.5992%   -16.8013%     
=================================================
  Files          1626       1751        +125     
  Lines        448838     635122     +186284     
=================================================
+ Hits         329449     359474      +30025     
- Misses        99185     251511     +152326     
- Partials      20204      24137       +3933     
Flag Coverage Δ
integration 36.8309% <100.0000%> (?)
unit 72.4731% <100.0000%> (-0.0296%) ⬇️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 51.9953% <ø> (+6.4033%) ⬆️

@dveeden
Copy link
Contributor

dveeden commented Oct 4, 2024

@mjonss this might be related to (or conflict with) what you are working on.

@mjonss
Copy link
Contributor

mjonss commented Oct 4, 2024

@mjonss this might be related to (or conflict with) what you are working on.

Yes, if this is merged, then I need to update #56442 as well.

@@ -1814,7 +1814,8 @@ func TestParseTimeFromFloat64(t *testing.T) {
{0.0, mysql.TypeDate, 0, 0, 0, 0, 0, 0, 0, nil},
{20000102030405, mysql.TypeDatetime, 2000, 1, 2, 3, 4, 5, 0, nil},
{20000102030405.015625, mysql.TypeDatetime, 2000, 1, 2, 3, 4, 5, 15625, nil},
{20000102030405.0078125, mysql.TypeDatetime, 2000, 1, 2, 3, 4, 5, 7812, nil},
{20000102030405.0078125, mysql.TypeDatetime, 2000, 1, 2, 3, 4, 5, 7813, nil},
Copy link
Contributor

Choose a reason for hiding this comment

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

The significant digits of the float fractional part is only '.008' I guess, so does it really matter if it is '.007812' or '.007813' ?
Just try this with your PR:

{20000102030405.0078139, mysql.TypeDatetime, 2000, 1, 2, 3, 4, 5, 7814, nil},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The fractional part is only .008 so the fractional part of your case is still 7813.
As #56339 (comment) said, I just want to make this behavior consistent with TiKV and MySQL.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, then I see.
Can you please add tests that will test TiKV/TiFlash/UniStore handling of co-processor calls for this (if exists), so we can show that all four implementations are the same?

Copy link
Contributor Author

@gengliqi gengliqi Oct 11, 2024

Choose a reason for hiding this comment

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

I added an integration test to test TiDB(Unistore)/TiKV. TiFlash does not support date_add/date_sub functions with float as the first parameter for now.

u
Signed-off-by: gengliqi <gengliqiii@gmail.com>
Signed-off-by: gengliqi <gengliqiii@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 11, 2024
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 18, 2024
Copy link

ti-chi-bot bot commented Oct 18, 2024

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent date_sub/date_add with MySQL when the type of first argument is float
3 participants