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

strange plan for "not(not())" and "< " condition without projection cause tikv copr error #25727

Closed
lysu opened this issue Jun 24, 2021 · 7 comments
Assignees
Labels
duplicate Issues or pull requests already exists. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@lysu
Copy link
Contributor

lysu commented Jun 24, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t1` (
  `col_70` mediumint(9) NOT NULL DEFAULT '-2830963',
  `col_71` year(4) NOT NULL,
  `col_72` char(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `col_73` enum('Alice','Bob','Charlie','David') NOT NULL DEFAULT 'Charlie',
  `col_74` smallint(5) unsigned DEFAULT '27052',
  `col_75` set('Alice','Bob','Charlie','David') NOT NULL,
  `col_76` binary(1) NOT NULL,
  `col_77` binary(2) NOT NULL,
  PRIMARY KEY (`col_75`,`col_77`,`col_72`,`col_76`,`col_73`,`col_71`,`col_70`) CLUSTERED
)

then exec SQL with the empty table

 select col_70, col_71, col_72, col_73, col_74, col_75, col_76, col_77 from t1  where not(col_71 not in ( '2033' , '2014' , '1978' ) ) and col_71 <= '1999';

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

success

3. What did you see instead (Required)

fail with tikv cop error

ERROR 1105 (HY000): other error: [components/tidb_query_expr/src/types/expr_builder.rs:357]: Unexpected ExprType Float64 and EvalType Int

plan seems be very stranger

image

but if we change SQL to delete some column in the projection, it will work

4. What is your TiDB version? (Required)

85dee1d

@lysu lysu added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner labels Jun 24, 2021
@lysu lysu changed the title strange plan for not(not()) and < without no projection strange plan for "not(not())" and "< " condition without projection cause tikv copr error Jun 24, 2021
@lysu
Copy link
Contributor Author

lysu commented Jun 24, 2021

@winoros please help take look or distribute to others guys thx~ :)

@winoros
Copy link
Member

winoros commented Jun 29, 2021

The merge result of not(col_71 not in ( '2033' , '2014' , '1978' ) ) and col_71 <= '1999' is col_71 = '1978'.

So the expr is correct

@winoros
Copy link
Member

winoros commented Jun 29, 2021

The column col_71's type is YEAR which is stored as int. So int = string should be add cast to cast(int as double) = cast(string as double).
But this function appears to be FloatEQ(INT_COL, FLOAT_VAL).

@xuyifangreeneyes
Copy link
Contributor

/assign

@xuyifangreeneyes
Copy link
Contributor

@lysu I cannot reproduce the error. Could you please check whether the bug still exists, thx~

@lysu
Copy link
Contributor Author

lysu commented Aug 20, 2021

yes it seems be same as #27245 already fixed by @wjhuang2016 in master and 5.1, but 5.1 ...

@lysu lysu closed this as completed Aug 20, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

@lysu lysu added the duplicate Issues or pull requests already exists. label Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues or pull requests already exists. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants