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

Cascade's LogicalTableScan derive stats with wrong range #23459

Open
lysu opened this issue Mar 22, 2021 · 4 comments
Open

Cascade's LogicalTableScan derive stats with wrong range #23459

lysu opened this issue Mar 22, 2021 · 4 comments
Labels
severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@lysu
Copy link
Contributor

lysu commented Mar 22, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

no reproduce but see it has something wrong in code

Screen Shot 2021-03-22 at 7 50 05 PM

LogicalTableScan only be used in cascade

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

build common handle range?

3. What did you see instead (Required)

TODO

4. What is your TiDB version? (Required)

master

@lysu lysu added the type/bug The issue is confirmed as a bug. label Mar 22, 2021
@lysu lysu changed the title Cascade / MPP's LogicalTableScan derive stats with wrong range Cascade's LogicalTableScan derive stats with wrong range Mar 22, 2021
@lysu lysu added the sig/planner SIG: Planner label Mar 22, 2021
@jackwener
Copy link
Contributor

@lysu Hi, I couldn't get your point. You think that Is it problem that BuildTableRange use LogicalTableScan?

Could you provide more details about question.

@jackwener
Copy link
Contributor

If the answer is yes, there isn't problem in fact. Cascades plan use many functions in plan.core

@moonsphere
Copy link

@lysu Hi, I couldn't get your point. You think that Is it problem that BuildTableRange use LogicalTableScan?

Could you provide more details about question.

the question in here should be only building primary key range by ts.HandleCols.GetCol(0), it's assumed TableScan over PK only contains 1 column. it's ok before the clustered index feature(table scan only can use auto-generated row_id or one column int primary key), but after clustered index shipped table scan need to handle multiple columns and different type columns's PK

maybe you can test it with create table t (a int, b int, c int, primary key(a, b) clustered)..

it seems this code less adopt to clustered index feature, it should build range for multiple columns, maybe it should sth like

func (ds *DataSource) deriveCommonHandleTablePathStats(path *util.AccessPath, conds []expression.Expression, isIm bool) (bool, error) {

PS: I'm not very sure if it has the problem, but just review the code and feel it seems to have the problem, feeling free to close it if recheck it's ok :)

@jackwener
Copy link
Contributor

Thanks for your reply, It was mentioned in TODO, I mistake there is other problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants