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

wrong stats of TestIssues24349 #59130

Closed
winoros opened this issue Jan 22, 2025 · 1 comment · Fixed by #59131
Closed

wrong stats of TestIssues24349 #59130

winoros opened this issue Jan 22, 2025 · 1 comment · Fixed by #59131
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@winoros
Copy link
Member

winoros commented Jan 22, 2025

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Image

Looking into column b's stats:

  • partition p0: TopN: (3, 3). Hist: one bucket [2, 2] with count = 1
  • partition p1: TopN: (2, 3), Hist: empty
  • partition p2: TopN: (1, 2), Hist: two buckets [1, 3] with count = 2 and repeat = 1, [4, 4] with count = 1 and repeat = 1

After fixing the global TopN, it is now 2 with 4 as its occurrence (local TopN of p1 and one single bucket from p0).

Remained buckets(TopN also treat as bucket)

  • [3, 3] count = 4, repeat = 4 (local TopN from p0 plus 1 from p2's bucket [1, 3]'s repeat)
  • [1, 1] count = 2, repeat = 2
  • [1, 3] count = 1, repeat = 0
  • [4, 4] count = 1, repeat = 1

After merging them to get the global histogram, we should get one bucket [1, 4] with count = 8 and repeat = 1.
But in the current test result, we have

Image
The count is 10.

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master.

@winoros winoros added affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug. labels Jan 22, 2025
@winoros
Copy link
Member Author

winoros commented Jan 22, 2025

It affects many branches. But I decide to only pick it to v8.5.

It's caused by that Column's histogram uses decoded column value while TopNs of it use encoded value.

@winoros winoros added affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 labels Jan 22, 2025
@qw4990 qw4990 changed the title wrong result of TestIssues24349 wrong stats of TestIssues24349 Jan 23, 2025
@ti-chi-bot ti-chi-bot bot closed this as completed in 41c3b01 Jan 23, 2025
@AilinKid AilinKid removed affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. labels Feb 6, 2025
@AilinKid AilinKid removed the affects-7.5 This bug affects the 7.5.x(LTS) versions. label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants