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

executor: select agg from json column return wrong result with the MySQL #25033

Closed
Tracked by #36993
AilinKid opened this issue Jun 1, 2021 · 2 comments
Closed
Tracked by #36993

Comments

@AilinKid
Copy link
Contributor

AilinKid commented Jun 1, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `tbl_3` (
  `col_15` json DEFAULT NULL,
  `col_16` json DEFAULT NULL,
  `col_17` json DEFAULT NULL,
  `col_18` json DEFAULT NULL,
  `col_19` json DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

insert into tbl_3 values("[1,1,1]", "66", "false", "-22", "-44");
insert into tbl_3 values("77", "33", "323232323.3232323", "-22", NULL);

select /*+ agg_to_cop() stream_agg() */ max(   col_17 ) aggCol from (select   * from tbl_3 where not( tbl_3.col_16 between null and 'piHWbXSXTQVt' ) or tbl_3.col_17 not in ( "[3, 2, 1]" , "false" )  ) ordered_tbl   limit 396 for update;

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

MySQL8

+--------+
| aggCol |
+--------+
| false  |
+--------+
1 row in set, 2 warnings (0.00 sec)

3. What did you see instead (Required)

TiDB

+-------------------+
| aggCol            |
+-------------------+
| 323232323.3232323 |
+-------------------+
1 row in set, 1 warning (0.00 sec)

4. What is your TiDB version? (Required)

master

@AilinKid AilinKid added type/bug The issue is confirmed as a bug. sig/execution SIG execution component/executor labels Jun 1, 2021
@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Jun 2, 2021

mysql> select /*+ agg_to_cop() stream_agg() */ max(   col_17 ) aggCol from (select   * from tbl_3 where not( tbl_3.col_16 between null and 'piHWbXSXTQVt' ) or tbl_3.col_17 not in ( "[3, 2, 1]" , "false" )  ) ordered_tbl   limit 396 for update;
+-------------------+
| aggCol            |
+-------------------+
| 323232323.3232323 |
+-------------------+
1 row in set, 3 warnings (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.23    |
+-----------+
1 row in set (0.01 sec)

@XuHuaiyu XuHuaiyu added type/compatibility and removed severity/critical type/bug The issue is confirmed as a bug. labels Jun 2, 2021
@xiongjiwei xiongjiwei self-assigned this Aug 22, 2022
@xiongjiwei
Copy link
Contributor

confirm it has been fixed

@xiongjiwei xiongjiwei mentioned this issue Aug 30, 2022
34 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants