You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement ORDER BY Clause Handling for SELECT DISTINCT in DatabendRandomQuerySynthesizer #1159
In the DatabendRandomQuerySynthesizer.java file, there is a TODO comment indicating that when generating SELECT DISTINCT queries, the ORDER BY expressions must appear in the select list. This functionality is currently not implemented, and we need to address this to ensure compliance with SQL standards.
The code snippet I am talking aboutt:
if (Randomly.getBoolean() && !noExprColumns.isEmpty() && !isDistinct) {
select.setOrderByClauses(Randomly.nonEmptySubset(noExprColumns));
// TODO (for SELECT DISTINCT, ORDER BY expressions must appear in select list)// isDistinct// 需要orderby输入每个select list,可以用数字代替比如:1,2,3...
}
What I'll Do
Modify the logic in the DatabendRandomQuerySynthesizer to ensure that when isDistinct is true, the ORDER BY clauses are derived from the select list.
Implement a mechanism to allow ORDER BY expressions to reference the select list by their position (e.g., using numbers like 1, 2, 3...).
Add unit tests to verify that the generated queries comply with the SQL standard for SELECT DISTINCT.
Activity