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

statistics: using standard lib slices instead of exp slices #45996

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

fatelei
Copy link
Contributor

@fatelei fatelei commented Aug 11, 2023

What problem does this PR solve?

using builtin slices lib instead of exp slices

Issue Number: ref #45933

Problem Summary:

What is changed and how it works?

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.

None

@ti-chi-bot ti-chi-bot bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Aug 11, 2023
@sre-bot
Copy link
Contributor

sre-bot commented Aug 11, 2023

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 11, 2023

Welcome @fatelei!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 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 Aug 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 11, 2023

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

@tiprow
Copy link

tiprow bot commented Aug 11, 2023

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

@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 Aug 11, 2023
@hawkingrei
Copy link
Member

@fatelei Thank you.

TiDB use bazel to speed up build/test/linter. so you need to run make bazel_prepare to update the bazel config.

@hawkingrei
Copy link
Member

@fatelei Thank you.

TiDB use bazel to speed up build/test/linter. so you need to run make bazel_prepare to update the bazel config.

CI will tell you where to change. you can update config by it.

@hawkingrei hawkingrei changed the title feat: pkg statistics using standard lib slices instead of exp slices statistics: using standard lib slices instead of exp slices Aug 11, 2023
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 11, 2023
@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Merging #45996 (0c095a4) into master (66033d5) will decrease coverage by 1.6643%.
Report is 9 commits behind head on master.
The diff coverage is 56.6666%.

❗ Current head 0c095a4 differs from pull request most recent head 5b4cab0. Consider uploading reports for the commit 5b4cab0 to get more accurate results

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #45996        +/-   ##
================================================
- Coverage   74.7898%   73.1256%   -1.6643%     
================================================
  Files          1293       1300         +7     
  Lines        398010     399704      +1694     
================================================
- Hits         297671     292286      -5385     
- Misses        80960      88828      +7868     
+ Partials      19379      18590       -789     
Flag Coverage Δ
integration 26.1058% <56.6666%> (-20.4640%) ⬇️

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

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 85.0494% <ø> (ø)
br 51.1288% <ø> (-13.6343%) ⬇️

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 11, 2023
@Rustin170506
Copy link
Member

/cc

@ti-chi-bot ti-chi-bot bot requested a review from Rustin170506 August 11, 2023 07:49
statistics/cmsketch.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 11, 2023
@fatelei fatelei force-pushed the go_121 branch 2 times, most recently from cb78ffb to 2c1c8a7 Compare August 11, 2023 10:38
@fatelei
Copy link
Contributor Author

fatelei commented Aug 11, 2023

bazel_prepare

done

@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 11, 2023
@hawkingrei
Copy link
Member

@fatelei Please fix the linter.

 statistics/analyze.go:1:1: 
--- statistics/cmsketch_test.go
+++ statistics/cmsketch_test.go
@@ -21,14 +21,13 @@
 	"testing"
 	"time"
 
-	"github.com/stretchr/testify/assert"
-
 	"github.com/pingcap/errors"
 	"github.com/pingcap/tidb/parser/mysql"
 	"github.com/pingcap/tidb/sessionctx/stmtctx"
 	"github.com/pingcap/tidb/types"
 	"github.com/pingcap/tidb/util/chunk"
 	"github.com/pingcap/tidb/util/codec"
+	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 ) 

@hawkingrei hawkingrei self-requested a review August 11, 2023 12:16
@fatelei
Copy link
Contributor Author

fatelei commented Aug 11, 2023

@fatelei Please fix the linter.

 statistics/analyze.go:1:1: 
--- statistics/cmsketch_test.go
+++ statistics/cmsketch_test.go
@@ -21,14 +21,13 @@
 	"testing"
 	"time"
 
-	"github.com/stretchr/testify/assert"
-
 	"github.com/pingcap/errors"
 	"github.com/pingcap/tidb/parser/mysql"
 	"github.com/pingcap/tidb/sessionctx/stmtctx"
 	"github.com/pingcap/tidb/types"
 	"github.com/pingcap/tidb/util/chunk"
 	"github.com/pingcap/tidb/util/codec"
+	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 ) 

done

@hawkingrei
Copy link
Member

/test all

@hawkingrei
Copy link
Member

@fatelei Some tests have failed, please check them.

statistics/cmsketch.go Outdated Show resolved Hide resolved
@hawkingrei
Copy link
Member

@fatelei Please run make bazel_preapre to update bazel config.

index 5c2461120..bd200e961 100644

--- a/statistics/BUILD.bazel

+++ b/statistics/BUILD.bazel

@@ -120,7 +120,6 @@ go_test(

         "@com_github_pingcap_errors//:errors",

         "@com_github_pingcap_failpoint//:failpoint",

         "@com_github_pingcap_log//:log",

-        "@com_github_stretchr_testify//assert",

         "@com_github_stretchr_testify//require",

         "@org_uber_go_goleak//:goleak",

         "@org_uber_go_zap//:zap",

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 14, 2023
@fatelei
Copy link
Contributor Author

fatelei commented Aug 14, 2023

@fatelei Please run make bazel_preapre to update bazel config.

index 5c2461120..bd200e961 100644

--- a/statistics/BUILD.bazel

+++ b/statistics/BUILD.bazel

@@ -120,7 +120,6 @@ go_test(

         "@com_github_pingcap_errors//:errors",

         "@com_github_pingcap_failpoint//:failpoint",

         "@com_github_pingcap_log//:log",

-        "@com_github_stretchr_testify//assert",

         "@com_github_stretchr_testify//require",

         "@org_uber_go_goleak//:goleak",

         "@org_uber_go_zap//:zap",

done

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 14, 2023
Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

Thanks!

if i.Count != j.Count {
return i.Count > j.Count
return cmp.Compare(j.Count, i.Count)
Copy link
Member

Choose a reason for hiding this comment

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

Could please add a note here?

@@ -339,6 +339,18 @@ func TestMergePartTopN2GlobalTopNWithoutHists(t *testing.T) {
require.Len(t, leftTopN, 1, "should have 1 left topN")
}

func TestSortTopnMeta(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

👍🏿

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, hi-rustin

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:
  • OWNERS [hawkingrei,hi-rustin]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 14, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 14, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-11 07:48:14.672496953 +0000 UTC m=+271659.221512935: ☑️ agreed by hawkingrei.
  • 2023-08-11 08:18:59.087099189 +0000 UTC m=+273503.636115176: ✖️🔁 reset by hi-rustin.
  • 2023-08-14 03:01:09.240362214 +0000 UTC m=+513633.789378201: ☑️ agreed by hawkingrei.
  • 2023-08-14 05:57:39.751774294 +0000 UTC m=+524224.300790280: ☑️ agreed by hi-rustin.

@ti-chi-bot ti-chi-bot bot merged commit 60588b9 into pingcap:master Aug 14, 2023
@D3Hunter D3Hunter mentioned this pull request Jun 4, 2024
13 tasks
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants