Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
github.com/dolthub/vitess v0.0.0-20241009160728-54c0746cbff7
github.com/dolthub/vitess v0.0.0-20241009211835-ba88416ec164
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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
github.com/dolthub/vitess v0.0.0-20241009160728-54c0746cbff7 h1:mepdzTqvr0ZAbyOEsdgLg/nJ2qQzLJIwHD7xityHzz4=
github.com/dolthub/vitess v0.0.0-20241009160728-54c0746cbff7/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
github.com/dolthub/vitess v0.0.0-20241009211835-ba88416ec164 h1:E801UUi91AGx0EfIA1/59hxfDpGI8P9Mvc9KHw8O5Rg=
github.com/dolthub/vitess v0.0.0-20241009211835-ba88416ec164/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
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=
Expand Down
2 changes: 1 addition & 1 deletion sql/planbuilder/create_ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (b *Builder) buildCreateProcedure(inScope *scope, subQuery string, fullQuer
err := fmt.Errorf("unknown procedure parameter direction: `%s`", string(param.Direction))
b.handleErr(err)
}
internalTyp, err := types.ColumnTypeToType(&param.Type)
internalTyp, err := types.ColumnTypeToType(param.Type)
if err != nil {
b.handleErr(err)
}
Expand Down
6 changes: 3 additions & 3 deletions sql/planbuilder/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ func (b *Builder) jsonTableSpecToSchemaHelper(jsonTableSpec *ast.JSONTableSpec,
b.jsonTableSpecToSchemaHelper(cd.Spec, sch)
continue
}
typ, err := types.ColumnTypeToType(&cd.Type)
typ, err := types.ColumnTypeToType(cd.Type)
if err != nil {
b.handleErr(err)
}
Expand Down Expand Up @@ -1362,7 +1362,7 @@ func getPkOrdinals(ts *ast.TableSpec) []int {
// columnDefinitionToColumn returns the sql.Column for the column definition given, as part of a create table
// statement. Defaults and generated expressions must be handled separately.
func (b *Builder) columnDefinitionToColumn(inScope *scope, cd *ast.ColumnDefinition, indexes []*ast.IndexDefinition) *sql.Column {
internalTyp, err := types.ColumnTypeToType(&cd.Type)
internalTyp, err := types.ColumnTypeToType(cd.Type)
if err != nil {
b.handleErr(err)
}
Expand Down Expand Up @@ -1703,7 +1703,7 @@ func ParseColumnTypeString(columnType string) (sql.Type, error) {
return nil, fmt.Errorf("failed to parse type info for column: %s", columnType)
}
parsedTyp := ddl.TableSpec.Columns[0].Type
typ, err := types.ColumnTypeToType(&parsedTyp)
typ, err := types.ColumnTypeToType(parsedTyp)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion sql/planbuilder/from.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ func (b *Builder) buildJSONTableCols(inScope *scope, jtSpec *ast.JSONTableSpec)
continue
}

typ, err := types.ColumnTypeToType(&jtColDef.Type)
typ, err := types.ColumnTypeToType(jtColDef.Type)
if err != nil {
b.handleErr(err)
}
Expand Down
2 changes: 1 addition & 1 deletion sql/planbuilder/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func (b *Builder) buildDeclareVariables(inScope *scope, d *ast.Declare) (outScop
outScope = inScope.push()
dVars := d.Variables
names := make([]string, len(dVars.Names))
typ, err := types.ColumnTypeToType(&dVars.VarType)
typ, err := types.ColumnTypeToType(dVars.VarType)
if err != nil {
err := err
b.handleErr(err)
Expand Down
3 changes: 3 additions & 0 deletions sql/planbuilder/scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,9 @@ func (b *Builder) convertInt(value string, base int) *expression.Literal {
}

func (b *Builder) ConvertVal(v *ast.SQLVal) sql.Expression {
if v == nil {
return nil
}
switch v.Type {
case ast.StrVal:
return expression.NewLiteral(string(v.Val), types.CreateLongText(b.ctx.GetCollation()))
Expand Down
10 changes: 6 additions & 4 deletions sql/planbuilder/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (b *Builder) buildSelect(inScope *scope, s *ast.Select) (outScope *scope) {
b.buildProjection(outScope, projScope)
outScope = projScope

b.buildDistinct(outScope, s.QueryOpts.Distinct)
b.buildDistinct(outScope, s.QueryOpts)

// OFFSET and LIMIT are last
offset := b.buildOffset(outScope, s.Limit)
Expand All @@ -117,7 +117,9 @@ func (b *Builder) buildSelect(inScope *scope, s *ast.Select) (outScope *scope) {
limit := b.buildLimit(outScope, s.Limit)
if limit != nil {
l := plan.NewLimit(limit, outScope.node)
l.CalcFoundRows = s.QueryOpts.SQLCalcFoundRows
if s.QueryOpts != nil {
l.CalcFoundRows = s.QueryOpts.SQLCalcFoundRows
}
outScope.node = l
}

Expand Down Expand Up @@ -194,8 +196,8 @@ func (b *Builder) typeCoerceLiteral(e sql.Expression) sql.Expression {

// buildDistinct creates a new plan.Distinct node if the query has a DISTINCT option.
// If the query has both DISTINCT and ALL, an error is returned.
func (b *Builder) buildDistinct(inScope *scope, distinct bool) {
if distinct {
func (b *Builder) buildDistinct(inScope *scope, qo *ast.QueryOpts) {
if qo != nil && qo.Distinct {
inScope.node = plan.NewDistinct(inScope.node)
}
}
Expand Down
Loading