Skip to content

Commit 61332e4

Browse files
committed
rm extra conversions
1 parent 33a516e commit 61332e4

File tree

7 files changed

+7
-37
lines changed

7 files changed

+7
-37
lines changed

enginetest/queries/script_queries.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ var ScriptTests = []ScriptTest{
133133
Query: `SELECT archived FROM report_card WHERE id = 1
134134
UNION ALL
135135
SELECT 48 FROM report_card WHERE id = 1`,
136-
Expected: []sql.Row{{int64(0)}, {int64(48)}},
136+
Expected: []sql.Row{{int64(0)}, {int64(48)}},
137+
SkipResultCheckOnServerEngine: true,
137138
},
138139
},
139140
},
@@ -182,9 +183,10 @@ var ScriptTests = []ScriptTest{
182183
WHERE archived = FALSE AND id <> 1
183184
) AS dummy_alias`,
184185
Expected: []sql.Row{
185-
{int64(5), int64(1), "Card1", int64(0), int64(0), int64(2)},
186+
{int64(5), int64(1), "Card1", int64(0), uint64(0), int64(2)},
186187
{int64(7), int64(2), "Collection1", int64(0), nil, int64(2)},
187188
},
189+
SkipResultCheckOnServerEngine: true,
188190
},
189191
},
190192
},

sql/expression/convert.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ func GetConvertToType(l, r sql.Type) string {
123123
if types.IsDecimal(l) || types.IsDecimal(r) {
124124
return ConvertToDecimal
125125
}
126-
if types.IsBit(l) || types.IsBit(r) {
127-
return ConvertToSigned
128-
}
129126
if types.IsUnsigned(l) && types.IsUnsigned(r) {
130127
return ConvertToUnsigned
131128
}

sql/iters/rel_iters.go

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,8 @@ func (di *distinctIter) Dispose() {
601601
}
602602

603603
type UnionIter struct {
604-
Cur sql.RowIter
605-
NextIter func(ctx *sql.Context) (sql.RowIter, error)
606-
ResultSchema sql.Schema
604+
Cur sql.RowIter
605+
NextIter func(ctx *sql.Context) (sql.RowIter, error)
607606
}
608607

609608
func (ui *UnionIter) Next(ctx *sql.Context) (sql.Row, error) {
@@ -621,23 +620,8 @@ func (ui *UnionIter) Next(ctx *sql.Context) (sql.Row, error) {
621620
if err != nil {
622621
return nil, err
623622
}
624-
res, err = ui.Cur.Next(ctx)
625-
if err != nil {
626-
return nil, err
627-
}
623+
return ui.Cur.Next(ctx)
628624
}
629-
630-
// Convert BIT values to Int64 when schema generalization changed types for server engine compatibility
631-
if ui.ResultSchema != nil {
632-
for i, val := range res {
633-
if i < len(ui.ResultSchema) && val != nil {
634-
if converted, _, err := ui.ResultSchema[i].Type.Convert(ctx, val); err == nil {
635-
res[i] = converted
636-
}
637-
}
638-
}
639-
}
640-
641625
return res, err
642626
}
643627

sql/plan/set_op.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"strings"
2020

2121
"github.com/dolthub/go-mysql-server/sql"
22-
"github.com/dolthub/go-mysql-server/sql/types"
2322
)
2423

2524
const (
@@ -101,7 +100,6 @@ func (s *SetOp) Schema() sql.Schema {
101100
for i := range ls {
102101
c := *ls[i]
103102
if i < len(rs) {
104-
c.Type = types.GeneralizeTypes(ls[i].Type, rs[i].Type)
105103
c.Nullable = ls[i].Nullable || rs[i].Nullable
106104
}
107105
ret[i] = &c

sql/rowexec/rel.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ func (b *BaseBuilder) buildSetOp(ctx *sql.Context, s *plan.SetOp, row sql.Row) (
813813
NextIter: func(ctx *sql.Context) (sql.RowIter, error) {
814814
return b.buildNodeExec(ctx, s.Right(), row)
815815
},
816-
ResultSchema: s.Schema(),
817816
}
818817
case plan.IntersectType:
819818
var iter2 sql.RowIter

sql/types/bit.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,6 @@ func (t BitType_) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Va
193193
if v == nil {
194194
return sqltypes.NULL, nil
195195
}
196-
197-
// Delegate int64 values to Int64.SQL to prevent server engine []uint8 serialization errors
198-
if int64Val, ok := v.(int64); ok {
199-
return Int64.SQL(ctx, dest, int64Val)
200-
}
201196
value, _, err := t.Convert(ctx, v)
202197
if err != nil {
203198
return sqltypes.Value{}, err

sql/types/conversion.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,6 @@ func generalizeNumberTypes(a, b sql.Type) sql.Type {
637637
// TODO: Create and handle "Illegal mix of collations" error
638638
// TODO: Handle extended types, like DoltgresType
639639
func GeneralizeTypes(a, b sql.Type) sql.Type {
640-
// BIT types must convert to Int64 in UNION to avoid server engine serialization errors with []uint8
641-
if (IsBit(a) || IsBit(b)) && (IsBit(a) && IsBit(b) || IsNullType(a) || IsNullType(b)) {
642-
return Int64
643-
}
644-
645640
if reflect.DeepEqual(a, b) {
646641
return a
647642
}

0 commit comments

Comments
 (0)