Skip to content

Commit b124b42

Browse files
author
James Cor
committed
Merge branch 'main' into james/update
2 parents 34e3d7e + a6e78e0 commit b124b42

File tree

8 files changed

+87
-123
lines changed

8 files changed

+87
-123
lines changed

enginetest/enginetests.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ func TestOrderByGroupBy(t *testing.T, harness Harness) {
657657
_, rowIter, _, err = e.Query(ctx, "select any_value(id), team from members group by team order by id")
658658
require.NoError(t, err)
659659
rowCount = 0
660-
isServerTest := IsServerEngine(e)
660+
661661
for {
662662
row, err = rowIter.Next(ctx)
663663
if err == io.EOF {
@@ -666,13 +666,14 @@ func TestOrderByGroupBy(t *testing.T, harness Harness) {
666666
rowCount++
667667
require.NoError(t, err)
668668

669-
// TODO: needs fix to match MySQL, which its type is `LONG` = Int32
670-
// currently, we convert any int result to SQL int64 type before sending it over the wire
671669
var val int64
672-
if isServerTest {
673-
val = row[0].(int64)
674-
} else {
675-
val = int64(row[0].(int32))
670+
switch v := row[0].(type) {
671+
case int64:
672+
val = v
673+
case int32:
674+
val = int64(v)
675+
default:
676+
panic(fmt.Sprintf("unexpected type %T", v))
676677
}
677678

678679
team := row[1].(string)
@@ -701,13 +702,14 @@ func TestOrderByGroupBy(t *testing.T, harness Harness) {
701702
rowCount++
702703
require.NoError(t, err)
703704

704-
// TODO: needs fix to match MySQL, which its type is `LONG` = Int32
705-
// currently, we convert any int result to SQL int64 type before sending it over the wire
706705
var val int64
707-
if isServerTest {
708-
val = row[0].(int64)
709-
} else {
710-
val = int64(row[0].(int32))
706+
switch v := row[0].(type) {
707+
case int64:
708+
val = v
709+
case int32:
710+
val = int64(v)
711+
default:
712+
panic(fmt.Sprintf("unexpected type %T", v))
711713
}
712714

713715
team := row[1].(string)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662
77
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71
88
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
9-
github.com/dolthub/vitess v0.0.0-20241016191424-d14e107a654e
9+
github.com/dolthub/vitess v0.0.0-20241028204000-267861bc75a0
1010
github.com/go-kit/kit v0.10.0
1111
github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d
1212
github.com/gocraft/dbr/v2 v2.7.2

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71 h1:bMGS25NWAGTE
5858
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71/go.mod h1:2/2zjLQ/JOOSbbSboojeg+cAwcRV0fDLzIiWch/lhqI=
5959
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9XGFa6q5Ap4Z/OhNkAMBaK5YeuEzwJt+NZdhiE=
6060
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
61-
github.com/dolthub/vitess v0.0.0-20241009160728-54c0746cbff7 h1:mepdzTqvr0ZAbyOEsdgLg/nJ2qQzLJIwHD7xityHzz4=
62-
github.com/dolthub/vitess v0.0.0-20241009160728-54c0746cbff7/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
63-
github.com/dolthub/vitess v0.0.0-20241010201417-9d4f54b29ccc h1:ZZgTRuxEwd3X67njtK30buHeZScLAd4W0rbRV8CORhE=
64-
github.com/dolthub/vitess v0.0.0-20241010201417-9d4f54b29ccc/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
65-
github.com/dolthub/vitess v0.0.0-20241016191424-d14e107a654e h1:Ssd/iV0hAOShAgr0c4pJQNgh2E4my2XHblFIIam0D+4=
66-
github.com/dolthub/vitess v0.0.0-20241016191424-d14e107a654e/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
61+
github.com/dolthub/vitess v0.0.0-20241028204000-267861bc75a0 h1:eeKypNsi1nQmjWxSAAWT6tvRsDWdmll03BozAUUIE4E=
62+
github.com/dolthub/vitess v0.0.0-20241028204000-267861bc75a0/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
6763
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
6864
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
6965
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=

sql/analyzer/analyzer.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,14 @@ func newInsertSourceSelector(sel RuleSelector) RuleSelector {
463463

464464
// Analyze applies the transformation rules to the node given. In the case of an error, the last successfully
465465
// transformed node is returned along with the error.
466-
func (a *Analyzer) Analyze(ctx *sql.Context, n sql.Node, scope *plan.Scope, qFlags *sql.QueryFlags) (sql.Node, error) {
467-
n, _, err := a.analyzeWithSelector(ctx, n, scope, SelectAllBatches, DefaultRuleSelector, qFlags)
468-
return n, err
466+
func (a *Analyzer) Analyze(ctx *sql.Context, node sql.Node, scope *plan.Scope, qFlags *sql.QueryFlags) (sql.Node, error) {
467+
switch n := node.(type) {
468+
case *plan.DescribeQuery:
469+
child, _, err := a.analyzeWithSelector(ctx, n.Query(), scope, SelectAllBatches, DefaultRuleSelector, qFlags)
470+
return n.WithQuery(child), err
471+
}
472+
node, _, err := a.analyzeWithSelector(ctx, node, scope, SelectAllBatches, DefaultRuleSelector, qFlags)
473+
return node, err
469474
}
470475

471476
func (a *Analyzer) analyzeThroughBatch(ctx *sql.Context, n sql.Node, scope *plan.Scope, until string, sel RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error) {

sql/analyzer/describe.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

sql/analyzer/rule_ids.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const (
1919
resolveCreateSelectId // resolveCreateSelect
2020
resolveSubqueriesId // resolveSubqueries
2121
resolveUnionsId // resolveUnions
22-
resolveDescribeQueryId // resolveDescribeQuery
2322
ValidateColumnDefaultsId // validateColumnDefaults
2423
validateCreateTriggerId // validateCreateTrigger
2524
validateCreateProcedureId // validateCreateProcedure

sql/analyzer/ruleid_string.go

Lines changed: 61 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sql/analyzer/rules.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ var OnceBeforeDefault = []Rule{
4646
{resolveCreateSelectId, resolveCreateSelect},
4747
{validateDropConstraintId, validateDropConstraint},
4848
{resolveUnionsId, resolveUnions},
49-
{resolveDescribeQueryId, resolveDescribeQuery}, //TODO
5049
{validateCreateTriggerId, validateCreateTrigger},
5150
{ValidateColumnDefaultsId, validateColumnDefaults},
5251
{validateReadOnlyDatabaseId, validateReadOnlyDatabase},

0 commit comments

Comments
 (0)