Skip to content

wrong stats of TestIssues24349 #59130

@winoros

Description

@winoros

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions