Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

sql/analyzer: replace column indexes with GetFields in SortFields #146

Merged
merged 1 commit into from
Apr 3, 2018

Conversation

erizocosmico
Copy link
Contributor

Fixes #144

Even if literals were being parsed correctly as the Column in the SortFields, we were not acting accordingly on the Sort node, because it acted as a literal and not a GetField expression.
This commit adds a rule to replace the Literal expression inside the SortField Column field into an UnresolvedColumn that will get resolved as any other column in the tree. By doing this with a rule, we avoid handling this special case inside the Sort node.

Fixes src-d#144

Even if literals were being parsed correctly as the Column in the SortFields, we were not acting accordingly on the Sort node, because it acted as a literal and not a GetField expression.
This commit adds a rule to replace the Literal expression inside the SortField Column field into an UnresolvedColumn that will get resolved as any other column in the tree. By doing this with a rule, we avoid handling this special case inside the Sort node.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
@erizocosmico erizocosmico merged commit 643aa1c into src-d:master Apr 3, 2018
@erizocosmico erizocosmico deleted the fix/order-by-col-idx branch April 3, 2018 10:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqllogictests: group by result with incorrect number of rows
3 participants