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

Conflict between DISTINCT and ORDER BY #52463

Open
ShaoxunLi opened this issue Oct 30, 2024 · 1 comment
Open

Conflict between DISTINCT and ORDER BY #52463

ShaoxunLi opened this issue Oct 30, 2024 · 1 comment
Labels
type/bug Something isn't working

Comments

@ShaoxunLi
Copy link
Contributor

ShaoxunLi commented Oct 30, 2024

Steps to reproduce the behavior (Required)

starrocks> select * from t;
+------+------+
| a    | b    |
+------+------+
|    4 | 4    |
|    5 | 1    |
|    1 | 1    |
|    3 | 3    |
|    2 | 2    |
+------+------+
5 rows in set (0.02 sec)

Real behavior (Required)

Setting sql_mode should make this SQL execute successfully, but it does not

starrocks> SELECT DISTINCT a from t order by b;
ERROR 1064 (HY000): Getting analyzing error at line 1, column 34. Detail message: '`test`.`t`.`b`' must be an aggregate expression or appear in GROUP BY clause.
starrocks> 
starrocks> set sql_mode = 0;
Query OK, 0 rows affected (0.00 sec)
starrocks> 
starrocks> SELECT DISTINCT a from t order by b;
ERROR 1064 (HY000): only found column statistics: {3: any_value}, but missing statistic of col: 1: a.

StarRocks version (Required)

3.1.10

@ShaoxunLi ShaoxunLi added the type/bug Something isn't working label Oct 30, 2024
@Baojia-Yang
Copy link

Keep an eye on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants