Skip to content

Commit 0291c46

Browse files
committed
Fixed problems with StrExpr, which was being used for other purposes by Doltgres query execution
1 parent 66d3d99 commit 0291c46

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

sql/plan/str_expr.go

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func AliasSubqueryString(e sql.Expression) string {
1313
e, _, err := transform.Expr(e, func(e sql.Expression) (sql.Expression, transform.TreeIdentity, error) {
1414
switch e := e.(type) {
1515
case *Subquery:
16-
return NewSubquery(NewStrExpr(e.QueryString), e.QueryString), transform.NewTree, nil
16+
return NewSubquery(NewStrExpr(e.QueryString, e), e.QueryString), transform.NewTree, nil
1717
default:
1818
return e, transform.SameTree, nil
1919
}
@@ -33,57 +33,49 @@ func AliasSubqueryString(e sql.Expression) string {
3333
}
3434

3535
// StrExpr is used exclusively for overriding the .String()
36-
// method of a node.
36+
// method of a subquery expression for efficiency and display purposes.
3737
type StrExpr struct {
38-
s string
38+
s string
39+
original *Subquery
3940
}
4041

4142
var _ sql.Node = (*StrExpr)(nil)
4243

44+
func NewStrExpr(s string, orig *Subquery) *StrExpr {
45+
return &StrExpr{
46+
s: s,
47+
original: orig,
48+
}
49+
}
50+
4351
func (s *StrExpr) Schema() sql.Schema {
44-
//TODO implement me
45-
panic("implement me")
52+
return s.original.Query.Schema()
4653
}
4754

4855
func (s *StrExpr) Children() []sql.Node {
49-
//TODO implement me
50-
panic("implement me")
56+
panic("StrExpr.Children should never be called")
5157
}
5258

5359
func (s *StrExpr) WithChildren(children ...sql.Node) (sql.Node, error) {
54-
//TODO implement me
55-
panic("implement me")
60+
panic("StrExpr.WithChildren should never be called")
5661
}
5762

5863
func (s *StrExpr) IsReadOnly() bool {
59-
//TODO implement me
60-
panic("implement me")
61-
}
62-
63-
func NewStrExpr(s string) *StrExpr {
64-
return &StrExpr{s: s}
64+
panic("StrExpr.IsReadOnly should never be called")
6565
}
6666

6767
func (s *StrExpr) Resolved() bool {
68-
//TODO implement me
69-
panic("implement me")
68+
return s.original.Resolved()
7069
}
7170

7271
func (s *StrExpr) String() string {
7372
return s.s
7473
}
7574

76-
func (s *StrExpr) Type() sql.Type {
77-
//TODO implement me
78-
panic("implement me")
79-
}
80-
8175
func (s *StrExpr) IsNullable() bool {
82-
//TODO implement me
83-
panic("implement me")
76+
panic("StrExpr.IsNullable should never be called")
8477
}
8578

8679
func (s *StrExpr) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
87-
//TODO implement me
88-
panic("implement me")
80+
panic("StrExpr.Eval should never be called")
8981
}

0 commit comments

Comments
 (0)