-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix alias, maintain column sort order #3564
Conversation
// Get the distinct fields across all mappers. | ||
var selectFields, aliasFields []string | ||
if e.stmt.HasWildcard() { | ||
sf := newStringSet() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this still be a stringset? What about select mean(value), max(value) from foo
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For select *
a stringSet
works perfect as it gets you the distinct fields sorted alphabetically. It's when it wasn't a select *
that the problem was encountered, and what this PR fixes.
select mean(value), max(value) from foo
scenario works and is tested with this test:
5f9d9df
to
9c1e4e0
Compare
+1 |
1 similar comment
+1 |
Fix alias, maintain column sort order
This PR fixes a couple issues.
Aliasing was no longer working per this issue:
Fixes #3530
Also, we were not maintaining column select order in our results. For example, if we issued
select foo, bar from baz
the column order in the return would bebar, foo
, notfoo, bar
. This is now corrected.