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

analyzer: do not erase sort node when pushing it down #818

Merged
merged 1 commit into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2536,6 +2536,12 @@ func TestOrderByGroupBy(t *testing.T) {
require.NoError(err)

require.Equal(expected, rows)

_, _, err = e.Query(
newCtx(),
"SELECT team, COUNT(*) FROM members GROUP BY team ORDER BY columndoesnotexist",
)
require.Error(err)
}

func TestTracing(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion sql/analyzer/resolve_orderby.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func pushSortDown(sort *plan.Sort) (sql.Node, error) {
plan.NewSort(sort.SortFields, child.Child),
), nil
case *plan.ResolvedTable:
return child, nil
return sort, nil
default:
children := child.Children()
if len(children) == 1 {
Expand Down