-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Fix issue with duplicate columns in SELECT (#42122)
Previously, if a column (field, scalar, alias) appeared more than once in the SELECT list, the value was returned only once (1st appearance) in each row. Fixes: #41811 (cherry picked from commit 097ea36)
- Loading branch information
Showing
5 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
x-pack/plugin/sql/qa/src/main/resources/agg-ordering.csv-spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
aggSumWithColumnRepeatedWithOrderAsc | ||
SELECT gender AS g, gender, SUM(salary) AS s3, SUM(salary), SUM(salary) AS s5 FROM test_emp GROUP BY gender ORDER BY SUM(salary); | ||
|
||
g:s | gender:s | s3:i | SUM(salary):i | s5:i | ||
null |null |487605 |487605 |487605 | ||
F |F |1666196|1666196 |1666196 | ||
M |M |2671054|2671054 |2671054 | ||
; | ||
|
||
aggSumWithAliasWithColumnRepeatedWithOrderDesc | ||
SELECT gender AS g, gender, SUM(salary) AS s3, SUM(salary), SUM(salary) AS s5 FROM test_emp GROUP BY g ORDER BY s5 DESC; | ||
|
||
g:s | gender:s | s3:i | SUM(salary):i | s5:i | ||
M |M |2671054|2671054 |2671054 | ||
F |F |1666196|1666196 |1666196 | ||
null |null |487605 |487605 |487605 | ||
; | ||
|
||
aggSumWithNumericRefWithColumnRepeatedWithOrderDesc | ||
SELECT gender AS g, gender, SUM(salary) AS s3, SUM(salary), SUM(salary) AS s5 FROM test_emp GROUP BY 2 ORDER BY 3 DESC; | ||
|
||
g:s | gender:s | s3:i | SUM(salary):i | s5:i | ||
M |M |2671054|2671054 |2671054 | ||
F |F |1666196|1666196 |1666196 | ||
null |null |487605 |487605 |487605 | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters