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

Commit d434557

Browse files
authored
analyzer: do not erase sort node when pushing it down (#818)
analyzer: do not erase sort node when pushing it down
2 parents 524efe1 + 93014cf commit d434557

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

engine_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -2821,6 +2821,12 @@ func TestOrderByGroupBy(t *testing.T) {
28212821
require.NoError(err)
28222822

28232823
require.Equal(expected, rows)
2824+
2825+
_, _, err = e.Query(
2826+
newCtx(),
2827+
"SELECT team, COUNT(*) FROM members GROUP BY team ORDER BY columndoesnotexist",
2828+
)
2829+
require.Error(err)
28242830
}
28252831

28262832
func TestTracing(t *testing.T) {

sql/analyzer/resolve_orderby.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func pushSortDown(sort *plan.Sort) (sql.Node, error) {
164164
plan.NewSort(sort.SortFields, child.Child),
165165
), nil
166166
case *plan.ResolvedTable:
167-
return child, nil
167+
return sort, nil
168168
default:
169169
children := child.Children()
170170
if len(children) == 1 {

0 commit comments

Comments
 (0)