diff --git a/go.mod b/go.mod index 555441356d..fef70202fb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e github.com/dolthub/jsonpath v0.0.2-0.20240201003050-392940944c15 github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 - github.com/dolthub/vitess v0.0.0-20240207220624-0c2d2128fb7b + github.com/dolthub/vitess v0.0.0-20240209125211-6c93b0341608 github.com/go-kit/kit v0.10.0 github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d github.com/gocraft/dbr/v2 v2.7.2 diff --git a/go.sum b/go.sum index d5423cfcbe..34e28b8a31 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,8 @@ github.com/dolthub/jsonpath v0.0.2-0.20240201003050-392940944c15 h1:sfTETOpsrNJP github.com/dolthub/jsonpath v0.0.2-0.20240201003050-392940944c15/go.mod h1:2/2zjLQ/JOOSbbSboojeg+cAwcRV0fDLzIiWch/lhqI= github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9XGFa6q5Ap4Z/OhNkAMBaK5YeuEzwJt+NZdhiE= github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY= -github.com/dolthub/vitess v0.0.0-20240207220624-0c2d2128fb7b h1:7Sxjtwd7Cm2ilQDFvyXPfCkNkJMK//2GBGb3aM9ht7k= -github.com/dolthub/vitess v0.0.0-20240207220624-0c2d2128fb7b/go.mod h1:IwjNXSQPymrja5pVqmfnYdcy7Uv7eNJNBPK/MEh9OOw= +github.com/dolthub/vitess v0.0.0-20240209125211-6c93b0341608 h1:jnInva1KcJJf/QQsxbN9tTJckOZf73EzUen8rrik0Yw= +github.com/dolthub/vitess v0.0.0-20240209125211-6c93b0341608/go.mod h1:IwjNXSQPymrja5pVqmfnYdcy7Uv7eNJNBPK/MEh9OOw= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= diff --git a/sql/planbuilder/scalar.go b/sql/planbuilder/scalar.go index dc9398b9e2..2cc03df576 100644 --- a/sql/planbuilder/scalar.go +++ b/sql/planbuilder/scalar.go @@ -243,10 +243,18 @@ func (b *Builder) buildScalar(inScope *scope, e ast.Expr) (ex sql.Expression) { } return ret case ast.InjectedExpr: - if expr, ok := v.Expression.(sql.Expression); ok { - return expr + resolvedChildren := make([]any, len(v.Children)) + for i, child := range v.Children { + resolvedChildren[i] = b.buildScalar(inScope, child) } - b.handleErr(fmt.Errorf("Injected expression is not a valid expression")) + expr, err := v.Expression.WithResolvedChildren(resolvedChildren) + if err != nil { + b.handleErr(err) + } + if sqlExpr, ok := expr.(sql.Expression); ok { + return sqlExpr + } + b.handleErr(fmt.Errorf("Injected expression does not resolve to a valid expression")) return nil case *ast.RangeCond: val := b.buildScalar(inScope, v.Left)