diff --git a/go.mod b/go.mod index 38d32860c2..81d5cb30cf 100644 --- a/go.mod +++ b/go.mod @@ -10,9 +10,9 @@ require ( github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241119094239-f4e529af734d github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 github.com/dolthub/go-icu-regex v0.0.0-20250327004329-6799764f2dad - github.com/dolthub/go-mysql-server v0.20.1-0.20250609235012-75f15bbda63a + github.com/dolthub/go-mysql-server v0.20.1-0.20250616221924-f07103b9e041 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 - github.com/dolthub/vitess v0.0.0-20250609213846-75541d7ef20a + github.com/dolthub/vitess v0.0.0-20250611225316-90a5898bfe26 github.com/fatih/color v1.13.0 github.com/goccy/go-json v0.10.2 github.com/gogo/protobuf v1.3.2 diff --git a/go.sum b/go.sum index ab9b579315..23b7c0d05a 100644 --- a/go.sum +++ b/go.sum @@ -266,8 +266,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U= github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0= github.com/dolthub/go-icu-regex v0.0.0-20250327004329-6799764f2dad h1:66ZPawHszNu37VPQckdhX1BPPVzREsGgNxQeefnlm3g= github.com/dolthub/go-icu-regex v0.0.0-20250327004329-6799764f2dad/go.mod h1:ylU4XjUpsMcvl/BKeRRMXSH7e7WBrPXdSLvnRJYrxEA= -github.com/dolthub/go-mysql-server v0.20.1-0.20250609235012-75f15bbda63a h1:Q7obvACozcTOz11+L55dh1muPtNweIJdzNY5m0PLfDU= -github.com/dolthub/go-mysql-server v0.20.1-0.20250609235012-75f15bbda63a/go.mod h1:yVcBcDGOyYHmciKmQ20JZ+Mr12lOjSnzpmuBMZKPQGo= +github.com/dolthub/go-mysql-server v0.20.1-0.20250616221924-f07103b9e041 h1:yHwBDMdKhx2reYoL3QDIW4SlNFsEPXAMD6v5O+XGf94= +github.com/dolthub/go-mysql-server v0.20.1-0.20250616221924-f07103b9e041/go.mod h1:zuYoQ3keJHAvWUWMLzbP9anvR32b3sy1Fm8wB8ukNxQ= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= @@ -276,8 +276,8 @@ github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71 h1:bMGS25NWAGTE github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71/go.mod h1:2/2zjLQ/JOOSbbSboojeg+cAwcRV0fDLzIiWch/lhqI= github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 h1:JWkKRE4EHUcEVQCMRBej8DYxjYjRz/9MdF/NNQh0o70= github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216/go.mod h1:e/FIZVvT2IR53HBCAo41NjqgtEnjMJGKca3Y/dAmZaA= -github.com/dolthub/vitess v0.0.0-20250609213846-75541d7ef20a h1:DWQt6KSgrkZYuxzvGflImldau0a3IfINhEGQnFst/pw= -github.com/dolthub/vitess v0.0.0-20250609213846-75541d7ef20a/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70= +github.com/dolthub/vitess v0.0.0-20250611225316-90a5898bfe26 h1:9Npf0JYVCrwe9edTfYD/pjIncCePNDiu4j50xLcV334= +github.com/dolthub/vitess v0.0.0-20250611225316-90a5898bfe26/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= diff --git a/server/expression/in_subquery.go b/server/expression/in_subquery.go index 113e818e43..cb3fde0bb4 100644 --- a/server/expression/in_subquery.go +++ b/server/expression/in_subquery.go @@ -15,12 +15,12 @@ package expression import ( - "context" "fmt" "github.com/cockroachdb/errors" "github.com/dolthub/go-mysql-server/sql" "github.com/dolthub/go-mysql-server/sql/expression" + "github.com/dolthub/go-mysql-server/sql/hash" "github.com/dolthub/go-mysql-server/sql/plan" "github.com/dolthub/go-mysql-server/sql/types" vitess "github.com/dolthub/vitess/go/vt/sqlparser" @@ -46,7 +46,7 @@ var _ sql.Expression = (*InSubquery)(nil) var _ expression.BinaryExpression = (*InSubquery)(nil) // nilKey is the hash of a row with a single nil value. -var nilKey, _ = sql.HashOf(context.TODO(), sql.NewRow(nil)) +var nilKey, _ = hash.HashOf(nil, nil, sql.NewRow(nil)) // NewInSubquery returns a new *InSubquery. func NewInSubquery() *InSubquery { @@ -74,9 +74,11 @@ func (in *InSubquery) Eval(ctx *sql.Context, row sql.Row) (any, error) { // To comply with the SQL standard, IN() returns NULL not only if the expression on the left hand side is NULL, but // also if no match is found in the list and one of the expressions in the list is NULL. leftNull := left == nil + lTyp := in.Left().Type() + rTyp := in.Right().Type() - if types.NumColumns(in.Left().Type()) != types.NumColumns(in.Right().Type()) { - return nil, sql.ErrInvalidOperandColumns.New(types.NumColumns(in.Left().Type()), types.NumColumns(in.Right().Type())) + if types.NumColumns(lTyp) != types.NumColumns(rTyp) { + return nil, sql.ErrInvalidOperandColumns.New(types.NumColumns(lTyp), types.NumColumns(rTyp)) } right := in.rightExpr @@ -97,7 +99,8 @@ func (in *InSubquery) Eval(ctx *sql.Context, row sql.Row) (any, error) { // TODO: it might be possible for the left value to hash to a different value than the right even though they pass // an equality check. We need to perform a type conversion here to catch this case. - key, err := sql.HashOf(ctx, sql.NewRow(left)) + // TODO: hash.HashOf expects the right type, which doesn't align with we currently do it. + key, err := hash.HashOf(ctx, sql.Schema{&sql.Column{Type: lTyp}}, sql.NewRow(left)) if err != nil { return nil, err }