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

*: use golang built-in functions rather than mathutil #56818

Conversation

songzhibin97
Copy link
Contributor

@songzhibin97 songzhibin97 commented Oct 24, 2024

What problem does this PR solve?

Issue Number: close #56594

Problem Summary:

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

Copy link

ti-chi-bot bot commented Oct 24, 2024

Hi @songzhibin97. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 24, 2024
Copy link

tiprow bot commented Oct 24, 2024

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

@songzhibin97
Copy link
Contributor Author

/test all

Copy link

ti-chi-bot bot commented Oct 24, 2024

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

In response to this:

/test all

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.

Copy link

tiprow bot commented Oct 24, 2024

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

In response to this:

/test all

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.

Copy link

ti-chi-bot bot commented Oct 24, 2024

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

In response to this:

/ok-to-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.

Copy link

tiprow bot commented Oct 24, 2024

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

In response to this:

/ok-to-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-sigs/prow repository.

@songzhibin97
Copy link
Contributor Author

#56594

@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 24, 2024
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 6 lines in your changes missing coverage. Please review.

Project coverage is 57.1376%. Comparing base (ed9a909) to head (4bdc30c).
Report is 3 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56818         +/-   ##
=================================================
- Coverage   73.2825%   57.1376%   -16.1450%     
=================================================
  Files          1636       1786        +150     
  Lines        453340     640720     +187380     
=================================================
+ Hits         332219     366092      +33873     
- Misses       100768     249575     +148807     
- Partials      20353      25053       +4700     
Flag Coverage Δ
integration 39.4459% <80.7017%> (?)
unit 72.6048% <89.2857%> (+0.1192%) ⬆️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 63.1634% <100.0000%> (+17.1721%) ⬆️

@songzhibin97
Copy link
Contributor Author

/retest

@lance6716 lance6716 changed the title feat :use-golang-built-in-functions-rather-than-mathutil #56594 *: use golang built-in functions rather than mathutil Oct 24, 2024
@lance6716
Copy link
Contributor

The CI message is

Please run `make bazel_prepare` to update `.bazel` files, or just apply the following git diff (run `git apply -` and paste following contents with ctrl-D as ending):
diff --git a/br/cmd/br/BUILD.bazel b/br/cmd/br/BUILD.bazel
index a20f29fce1..6e3615a62c 100644
--- a/br/cmd/br/BUILD.bazel
+++ b/br/cmd/br/BUILD.bazel
@@ -37,7 +37,6 @@ go_library(
         "//pkg/util",
         "//pkg/util/gctuner",
         "//pkg/util/logutil",
-        "//pkg/util/mathutil",
         "//pkg/util/memory",
         "//pkg/util/metricsutil",
         "//pkg/util/redact",
diff --git a/cmd/importer/BUILD.bazel b/cmd/importer/BUILD.bazel
index cd8de53165..e11e994a22 100644
--- a/cmd/importer/BUILD.bazel
+++ b/cmd/importer/BUILD.bazel
@@ -26,7 +26,6 @@ go_library(
         "//pkg/statistics/handle/storage",
         "//pkg/statistics/handle/util",
         "//pkg/types",
-        "//pkg/util/mathutil",
         "@com_github_burntsushi_toml//:toml",
         "@com_github_go_sql_driver_mysql//:mysql",
         "@com_github_pingcap_errors//:errors",
diff --git a/pkg/autoid_service/BUILD.bazel b/pkg/autoid_service/BUILD.bazel
index 54054f5362..8cfbe0007b 100644
--- a/pkg/autoid_service/BUILD.bazel
+++ b/pkg/autoid_service/BUILD.bazel
@@ -16,7 +16,6 @@ go_library(
         "//pkg/owner",
         "//pkg/util/etcd",
         "//pkg/util/logutil",
-        "//pkg/util/mathutil",
         "@com_github_pingcap_errors//:errors",
         "@com_github_pingcap_failpoint//:failpoint",
         "@com_github_pingcap_kvproto//pkg/autoid",
diff --git a/pkg/ddl/tests/partition/BUILD.bazel b/pkg/ddl/tests/partition/BUILD.bazel
index 6af9cc3391..7f65dece9d 100644
--- a/pkg/ddl/tests/partition/BUILD.bazel
+++ b/pkg/ddl/tests/partition/BUILD.bazel
@@ -41,7 +41,6 @@ go_test(
         "//pkg/util/codec",
         "//pkg/util/dbterror",
         "//pkg/util/logutil",
-        "//pkg/util/mathutil",
         "@com_github_pingcap_errors//:errors",
         "@com_github_pingcap_failpoint//:failpoint",
         "@com_github_stretchr_testify//assert",
diff --git a/pkg/executor/importer/BUILD.bazel b/pkg/executor/importer/BUILD.bazel
index b878428a97..45affc02d7 100644
--- a/pkg/executor/importer/BUILD.bazel
+++ b/pkg/executor/importer/BUILD.bazel
@@ -66,7 +66,6 @@ go_library(
         "//pkg/util/filter",
         "//pkg/util/intest",
         "//pkg/util/logutil",
-        "//pkg/util/mathutil",
         "//pkg/util/promutil",
         "//pkg/util/sqlexec",
         "//pkg/util/sqlkiller",
diff --git a/pkg/parser/types/BUILD.bazel b/pkg/parser/types/BUILD.bazel
index 4e82ed0da8..c9af955d45 100644
--- a/pkg/parser/types/BUILD.bazel
+++ b/pkg/parser/types/BUILD.bazel
@@ -14,7 +14,6 @@ go_library(
         "//pkg/parser/format",
         "//pkg/parser/mysql",
         "//pkg/parser/terror",
-        "@com_github_cznic_mathutil//:mathutil",
     ],
 )
 
diff --git a/pkg/privilege/privileges/BUILD.bazel b/pkg/privilege/privileges/BUILD.bazel
index 3d12422553..3b095b09a3 100644
--- a/pkg/privilege/privileges/BUILD.bazel
+++ b/pkg/privilege/privileges/BUILD.bazel
@@ -31,7 +31,6 @@ go_library(
         "//pkg/util/dbterror",
         "//pkg/util/hack",
         "//pkg/util/logutil",
-        "//pkg/util/mathutil",
         "//pkg/util/sem",
         "//pkg/util/stringutil",
         "@com_github_lestrrat_go_jwx_v2//jwk",
diff --git a/pkg/util/cdcutil/BUILD.bazel b/pkg/util/cdcutil/BUILD.bazel
index 5b70a0cc29..805598f965 100644
--- a/pkg/util/cdcutil/BUILD.bazel
+++ b/pkg/util/cdcutil/BUILD.bazel
@@ -6,7 +6,6 @@ go_library(
     importpath = "github.com/pingcap/tidb/pkg/util/cdcutil",
     visibility = ["//visibility:public"],
     deps = [
-        "//pkg/util/mathutil",
         "@com_github_pingcap_errors//:errors",
         "@com_github_pingcap_log//:log",
         "@io_etcd_go_etcd_client_v3//:client",
diff --git a/pkg/util/mvmap/BUILD.bazel b/pkg/util/mvmap/BUILD.bazel
index 83144cce78..5596e1820b 100644
--- a/pkg/util/mvmap/BUILD.bazel
+++ b/pkg/util/mvmap/BUILD.bazel
@@ -8,7 +8,6 @@ go_library(
     ],
     importpath = "github.com/pingcap/tidb/pkg/util/mvmap",
     visibility = ["//visibility:public"],
-    deps = ["//pkg/util/mathutil"],
 )
 
 go_test(
diff --git a/tools/tazel/BUILD.bazel b/tools/tazel/BUILD.bazel
index d087ef079e..2e6c2c4330 100644
--- a/tools/tazel/BUILD.bazel
+++ b/tools/tazel/BUILD.bazel
@@ -10,7 +10,6 @@ go_library(
     importpath = "github.com/pingcap/tidb/tools/tazel",
     visibility = ["//visibility:private"],
     deps = [
-        "//pkg/util/mathutil",
         "//pkg/util/set",
         "@com_github_bazelbuild_buildtools//build:go_default_library",
         "@com_github_pingcap_log//:log",

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 24, 2024
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 24, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 25, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 25, 2024
Copy link

ti-chi-bot bot commented Oct 25, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-25 01:31:03.398490689 +0000 UTC m=+573864.095281320: ☑️ agreed by Defined2014.
  • 2024-10-25 01:55:16.382025018 +0000 UTC m=+575317.078815628: ☑️ agreed by lance6716.

@lance6716
Copy link
Contributor

/cc @D3Hunter

@ti-chi-bot ti-chi-bot bot requested a review from D3Hunter October 25, 2024 02:09
@lance6716
Copy link
Contributor

/cc @bb7133 @windtalker

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

ti-chi-bot bot commented Oct 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, hawkingrei, lance6716, tangenta, tiancaiamao, windtalker, YuJuncen

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 the approved label Oct 25, 2024
@ti-chi-bot ti-chi-bot bot merged commit 5faeca4 into pingcap:master Oct 25, 2024
40 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-none Denotes a PR that doesn't merit a release note. 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.

use golang built-in functions rather than mathutil
8 participants