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 plan type for dataReaderBuilder #16973

Closed
elvizlai opened this issue May 6, 2020 · 2 comments · Fixed by #17028
Closed

Wrong plan type for dataReaderBuilder #16973

elvizlai opened this issue May 6, 2020 · 2 comments · Fixed by #17028
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@elvizlai
Copy link
Contributor

elvizlai commented May 6, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. What did you do?

create table t1(
	id varchar(36) not null primary key,
	org_id varchar(36) not null,
	status tinyint default 1 not null,
	ns varchar(36) default '' not null
);

create table t2(
	id varchar(36) not null primary key,
	order_id varchar(36) not null,
	begin_time timestamp(3) default CURRENT_TIMESTAMP(3) not null
);
create index idx_oid on t2(order_id);

insert into t1 value (1,1,1,'a');
insert into t1 value (2,1,2,'a');
insert into t1 value (3,1,3,'a');

insert into t2 value (1,2,CURRENT_TIMESTAMP(3));

# v3.1.0 works, but NOT v3.1.1
SELECT COUNT(*)
FROM  t1
         LEFT JOIN t2 ON t1.id = t2.order_id
WHERE t1.ns = 'a'
  AND t1.org_id IN (1)
  AND t1.status IN (2,6,10)
  AND MONTH(t2.begin_time) = MONTH('2020-05-06 10:17:24');

# using proper args for left side works
SELECT COUNT(*)
FROM  t1
         LEFT JOIN t2 ON t1.id = t2.order_id
WHERE t1.ns = 'a'
  AND t1.org_id IN (1)
  AND t1.status IN (2,6,10)
  AND MONTH(DATE(t2.begin_time)) = MONTH('2020-05-06 10:17:24');

OR changing t1.status to CONVERT(t1.status, CHAR) also works.

2. What did you expect to see?

count return

3. What did you see instead?

Wrong plan type for dataReaderBuilder

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

Release Version: v3.1.1
Git Commit Hash: df4c9f05c49c6b8de74083d3befc20ecd8cefbfd
Git Branch: heads/refs/tags/v3.1.1
UTC Build Time: 2020-04-30 10:25:16
GoVersion: go version go1.13 linux/amd64
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@elvizlai elvizlai added the type/bug The issue is confirmed as a bug. label May 6, 2020
@elvizlai
Copy link
Contributor Author

elvizlai commented May 6, 2020

Jietu20200506-111915

The returned type is *core.PhysicalSelection

@wjhuang2016
Copy link
Member

It's introduced by this PR #16513, @windtalker PTAL

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

Successfully merging a pull request may close this issue.

3 participants