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

Fix alias, maintain column sort order #3564

Merged
merged 3 commits into from
Aug 6, 2015
Merged

Fix alias, maintain column sort order #3564

merged 3 commits into from
Aug 6, 2015

Conversation

corylanou
Copy link
Contributor

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 be bar, foo, not foo, bar. This is now corrected.

// Get the distinct fields across all mappers.
var selectFields, aliasFields []string
if e.stmt.HasWildcard() {
sf := newStringSet()
Copy link
Member

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?

Copy link
Contributor Author

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:

https://github.com/influxdb/influxdb/pull/3564/files#diff-09d8dc75f001e1e2a64439ee67dd14cbR1062

@corylanou corylanou force-pushed the fix-alias branch 2 times, most recently from 5f9d9df to 9c1e4e0 Compare August 6, 2015 15:49
@pauldix
Copy link
Member

pauldix commented Aug 6, 2015

+1

1 similar comment
@dgnorton
Copy link
Contributor

dgnorton commented Aug 6, 2015

+1

corylanou added a commit that referenced this pull request Aug 6, 2015
Fix alias, maintain column sort order
@corylanou corylanou merged commit e4674d4 into master Aug 6, 2015
@corylanou corylanou deleted the fix-alias branch August 6, 2015 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aliasing a column no longer works
3 participants