lide-reed opened a new issue, #21436: URL: https://github.com/apache/doris/issues/21436
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Version 1.2.x, 2.x, master ### What's Wrong? CREATE TABLE t ( `goods_no` varchar(50) NULL COMMENT '商品编号', `pg_code` varchar(20) NULL COMMENT 'PG组', `year_month` varchar(10) NULL COMMENT '统计年月', `goods_qty` bigint(20) NULL COMMENT '销量' ) ENGINE=OLAP DUPLICATE KEY(`goods_no`) DISTRIBUTED BY HASH(`goods_no`) BUCKETS 3; SELECT `year_month` FROM ( SELECT goods_no, pg_code, `year_month` , if(r_num = 1, goods_qty, 0) AS sales_quantity FROM ( SELECT goods_no , if(pg_code IS NULL, '', pg_code) AS pg_code , row_number() OVER (PARTITION BY `year_month`, goods_no ) AS r_num, `year_month`, goods_qty FROM t ) t1 ) tmp; ### What You Expected? no error ### How to Reproduce? MySQL [testdb]> CREATE TABLE t ( -> c1 varchar(50) NULL, -> c2 varchar(20) NULL, -> c3 varchar(10) NULL, -> c4 bigint(20) NULL -> ) ENGINE=OLAP -> DUPLICATE KEY(`c1`) -> DISTRIBUTED BY HASH(`c1`) BUCKETS 3; Query OK, 0 rows affected (0.01 sec) MySQL [testdb]> MySQL [testdb]> MySQL [testdb]> SELECT c3 -> FROM ( -> SELECT c1, c2, c3 -> , if(r_num = 1, c4, 0) AS sales_quantity -> FROM ( -> SELECT c1 -> , if(c2 IS NULL, '', c2) AS c2 -> , row_number() OVER (PARTITION BY c3, c1 ) AS r_num, c3, c4 -> FROM t -> ) t1 -> ) tmp; ERROR 1105 (HY000): errCode = 2, detailMessage = Unexpected exception: Index: 3, Size: 2 ### Anything Else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org