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

aggregate query gets 'should ensure all columns have the same length' error on partition table #49681

Open
wjhuang2016 opened this issue Dec 21, 2023 · 1 comment
Assignees
Labels
fuzz/randomtest severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `tl339c67ba` (
  `col_41` datetime NOT NULL DEFAULT '2011-05-21 00:00:00',
  `col_42` char(92) NOT NULL,
  `col_43` float DEFAULT '6891.0747',
  `col_44` char(5) DEFAULT 'b_',
  `col_45` smallint(6) DEFAULT '-7116',
  `col_46` json NOT NULL,
  `col_47` date NOT NULL,
  `col_48` time NOT NULL,
  `col_49` json DEFAULT NULL,
  `col_50` mediumint(8) unsigned NOT NULL,
  KEY `idx_17` ((cast(`col_46` as unsigned array)),`col_44`,`col_45`),
  PRIMARY KEY (`col_50`,`col_42`) /*T![clustered_index] NONCLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci
PARTITION BY HASH (`col_50`) PARTITIONS 6;
INSERT INTO `tl339c67ba` VALUES ('2024-02-13 00:00:00','l',NULL,'P5',14565,'800370530','1998-09-03','06:25:19','[-137365.35472449657, 98740.22614562341, -96230.65667019188, 81088.77765708079, 126813.96345066803, 228411.26303739505, -31360.293560806753, -40673.38888043809, 421555.88300412416, 4097.420882023372, -43759.19093454673, -618381.5308285163, 57324.58237695448, -11254.431120740595, -11831.811494338499, 632228.8397806884, -147234.135661395, -10233.283960475097, -60623.850914205344, 20194.112452002195, 31881.62808860628, 20531.172403172404, -48548.85255468495, 104726.24161292956, -180867.75742741392, 160201.2879594866]',16155661);

SELECT AVG(DISTINCT `tl339c67ba`.`col_50`) AS `r0`,RTRIM(`tl339c67ba`.`col_42`) AS `r1`,`tl339c67ba`.`col_43` AS `r2` FROM `tl339c67ba` WHERE `tl339c67ba`.`col_49`!=_UTF8MB4'2110938915' GROUP BY `tl339c67ba`.`col_43`,`tl339c67ba`.`col_47`,`tl339c67ba`.`col_42`;

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

MySQL:

mysql> SELECT AVG(DISTINCT `tl339c67ba`.`col_50`) AS `r0`,RTRIM(`tl339c67ba`.`col_42`) AS `r1`,`tl339c67ba`.`col_43` AS `r2` FROM `tl339c67ba` WHERE `tl339c67ba`.`col_49`!=_UTF8MB4'2110938915' GROUP BY `tl339c67ba`.`col_43`,`tl339c67ba`.`col_47`,`tl339c67ba`.`col_42`;
+---------------+------+------+
| r0            | r1   | r2   |
+---------------+------+------+
| 16155661.0000 | l    | NULL |
+---------------+------+------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

mysql> SELECT AVG(DISTINCT `tl339c67ba`.`col_50`) AS `r0`,RTRIM(`tl339c67ba`.`col_42`) AS `r1`,`tl339c67ba`.`col_43` AS `r2` FROM `tl339c67ba` WHERE `tl339c67ba`.`col_49`!=_UTF8MB4'2110938915' GROUP BY `tl339c67ba`.`col_43`,`tl339c67ba`.`col_47`,`tl339c67ba`.`col_42`;
ERROR 1105 (HY000): should ensure all columns have the same length, expect 1, but got 0

4. What is your TiDB version? (Required)

nightly-7d33d0d226ea69ef49fb0a6786f8972e112adf4b

@wjhuang2016 wjhuang2016 added the type/bug The issue is confirmed as a bug. label Dec 21, 2023
@wjhuang2016
Copy link
Member Author

related to #49680

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

No branches or pull requests

3 participants