Skip to content

Commit 9fd1090

Browse files
ajnavarrosmola
authored andcommitted
Node Resolved implementation now checks expressions too (#30)
1 parent 42bf507 commit 9fd1090

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

sql/plan/filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (p *Filter) Schema() sql.Schema {
1919
}
2020

2121
func (p *Filter) Resolved() bool {
22-
return p.UnaryNode.Child.Resolved()
22+
return p.UnaryNode.Child.Resolved() && p.expression.Resolved()
2323
}
2424

2525
func (p *Filter) RowIter() (sql.RowIter, error) {

sql/plan/project.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ func (p *Project) Schema() sql.Schema {
3333
}
3434

3535
func (p *Project) Resolved() bool {
36-
return p.UnaryNode.Child.Resolved()
36+
return p.UnaryNode.Child.Resolved() && p.expressionsResolved()
37+
}
38+
39+
func (p *Project) expressionsResolved() bool {
40+
for _, e := range p.expressions {
41+
if !e.Resolved() {
42+
return false
43+
}
44+
}
45+
return true
3746
}
3847

3948
func (p *Project) RowIter() (sql.RowIter, error) {

sql/plan/sort.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ func NewSort(sortFields []SortField, child sql.Node) *Sort {
3232
}
3333

3434
func (s *Sort) Resolved() bool {
35-
return s.UnaryNode.Child.Resolved()
35+
return s.UnaryNode.Child.Resolved() && s.expressionsResolved()
36+
}
37+
38+
func (p *Sort) expressionsResolved() bool {
39+
for _, f := range p.sortFields {
40+
if !f.Column.Resolved() {
41+
return false
42+
}
43+
}
44+
return true
3645
}
3746

3847
func (s *Sort) Schema() sql.Schema {

0 commit comments

Comments
 (0)