@@ -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 .
3737type StrExpr struct {
38- s string
38+ s string
39+ original * Subquery
3940}
4041
4142var _ 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+
4351func (s * StrExpr ) Schema () sql.Schema {
44- //TODO implement me
45- panic ("implement me" )
52+ return s .original .Query .Schema ()
4653}
4754
4855func (s * StrExpr ) Children () []sql.Node {
49- //TODO implement me
50- panic ("implement me" )
56+ panic ("StrExpr.Children should never be called" )
5157}
5258
5359func (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
5863func (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
6767func (s * StrExpr ) Resolved () bool {
68- //TODO implement me
69- panic ("implement me" )
68+ return s .original .Resolved ()
7069}
7170
7271func (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-
8175func (s * StrExpr ) IsNullable () bool {
82- //TODO implement me
83- panic ("implement me" )
76+ panic ("StrExpr.IsNullable should never be called" )
8477}
8578
8679func (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