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: TopN result in a wrong order #16501

Closed
zhongzc opened this issue Apr 17, 2020 · 2 comments · Fixed by #16542
Closed

executor: TopN result in a wrong order #16501

zhongzc opened this issue Apr 17, 2020 · 2 comments · Fixed by #16542
Assignees
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@zhongzc
Copy link
Contributor

zhongzc commented Apr 17, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. What did you do?

CI task integration-copr-test failed
data: https://github.com/tikv/copr-test/blob/master/push-down-test/prepare/0_data.sql

2. What did you expect to see?

Test pass

3. What did you see instead?

[2020-04-08T13:54:16.385Z] Statement: #507 -  SELECT COALESCE( `col_tinyint_unsigned`, ( COALESCE( ( LEAST( `col_double_unsigned_key`, 4556, ( '2000-01-09' >= ( STRCMP( `col_time_key`, `col_smallint_unsigned_key` ) ) ) ) ), ( ( STRCMP( ( `col_float_unsigned` IS NOT TRUE ), `col_char_255_key` ) ) > ( 'nmo' != -15482 ) ), '1990-06-16 17:22:56.005534' ) ), '2007-07-03', `col_float`, ( `col_float` BETWEEN 0 AND ( ( GREATEST( ( ( `col_set` <=> '2027-11-11' ) <> ( ( ( COALESCE( 'moxqnhbnkyxksjwoaajpbxxobggqewsbvtlqqjkkakmuskosyzsuhdlvfrhobgixtbeqjisgazsdqtccshcxarzvuxsjteeyxmzfxpu', 'p' ) ) IS NULL ) < ( STRCMP( ( `col_int_key` >= 'oxqnhbnkyxksjwoaajpbxxobggqewsbvtlqqjkkakmuskosyzsuhdlvfrhobgixtbeqjisgazsdqtccshcxarzvuxsjteeyxmzfxpuenwuwdczcyaumvpzhxuzftshcwrycsohwtdkrljskkbbbpvsxhzmlpqxozpcrpvqevuvdosgxtlunuhjyomjbucywsqgvbwromzotrdldqfpqvjaxfyhndbzyuuupvchaxe' ), ( -24369 != 'xqnhbnkyxksjwoaajpbxxobggqewsbvtlqqjkkakmuskosyzsuhdlvfrhobgixtbeqjisgazsdqtccshcxarzvuxsjteeyxmzfxpuenwuwdczcyaumvpzhxuzftshcwrycsohwtdkrljskkbbbpvsxhzmlpqxozpcrpvqevuvdosgxtlunuhjyomjbucywsqgvbwromz' ) ) ) ) ), '20:14:46.019164' ) ) <> 'j' ) ) ) AS field1, ISNULL( ( ( ( STRCMP( ( `col_year` IS FALSE ), 7334674943126274048 ) ) IN ( -607985949695016960, `col_varbinary_32`, '2023-03-02 19:05:21.008216', ( 0 < 0 ), `col_set_key` ) ) NOT BETWEEN ( ( 51 IS NOT NULL ) NOT IN ( NULL, ( ISNULL( ( `col_varbinary_32_key` IS UNKNOWN ) ) ) ) ) AND `col_binary_8_key` ) ) AS field2, LEAST( `col_varbinary_32_key`, `col_text_key` ) AS field3 FROM `table1000_int_autoinc` WHERE ( 0 <> `col_decimal_unsigned_key` ) IN ( ( COALESCE( ( `col_double_unsigned` = `col_char_2` ), `col_datetime_key` ) ), ( INTERVAL( ( COALESCE( '04:24:43.033324' ) ), `col_text` ) ) ) ORDER BY field1, field2, field3 LIMIT 7 /* QNO 509 CON_ID 196 */ ;
[2020-04-08T13:54:16.385Z] NoPushDown Output: 
[2020-04-08T13:54:16.385Z] field1	field2	field3
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	0
[2020-04-08T13:54:16.385Z] 0	0	1622605824
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	199229440
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 
[2020-04-08T13:54:16.385Z] 
[2020-04-08T13:54:16.385Z] WithPushDown Output: 
[2020-04-08T13:54:16.385Z] field1	field2	field3
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL
[2020-04-08T13:54:16.385Z] 0	0	NULL

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

master

@zhongzc zhongzc added type/bug The issue is confirmed as a bug. sig/execution SIG execution labels Apr 17, 2020
@zhongzc
Copy link
Contributor Author

zhongzc commented Apr 17, 2020

[2020-04-17T07:12:09.261Z] Test case: sql/randgen-topn/2_logical_1.sql
[2020-04-17T07:12:09.261Z] Statement: #984 -  SELECT ( NULL && ( NOT '1991-12-15' ) ) ^ ( `col_timestamp` AND ( `col_char_2` ^ `col_tinyint_key` ) ) AS field1, '11:54:15.059281' << ( ~ `col_varchar_64_key` ) AS field2 FROM `table20_int_autoinc` WHERE NOT `col_decimal` ORDER BY field1, field2 LIMIT 5 /* QNO 989 CON_ID 96 */ ;
[2020-04-17T07:12:09.261Z] NoPushDown Output: 
[2020-04-17T07:12:09.261Z] field1	field2
[2020-04-17T07:12:09.261Z] NULL	0
[2020-04-17T07:12:09.261Z] NULL	0
[2020-04-17T07:12:09.261Z] NULL	0
[2020-04-17T07:12:09.261Z] 0	NULL
[2020-04-17T07:12:09.261Z] 0	NULL
[2020-04-17T07:12:09.261Z] 
[2020-04-17T07:12:09.261Z] 
[2020-04-17T07:12:09.261Z] WithPushDown Output: 
[2020-04-17T07:12:09.261Z] field1	field2
[2020-04-17T07:12:09.261Z] NULL	0
[2020-04-17T07:12:09.261Z] 0	NULL
[2020-04-17T07:12:09.261Z] 0	NULL
[2020-04-17T07:12:09.261Z] 0	0
[2020-04-17T07:12:09.261Z] 0	0

@Reminiscent
Copy link
Contributor

Can be fixed by #16542

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

Successfully merging a pull request may close this issue.

3 participants