Skip to content

Commit bb52372

Browse files
committed
add conv for bit
1 parent 61332e4 commit bb52372

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

enginetest/queries/script_queries.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ var ScriptTests = []ScriptTest{
134134
UNION ALL
135135
SELECT 48 FROM report_card WHERE id = 1`,
136136
Expected: []sql.Row{{int64(0)}, {int64(48)}},
137+
// Server engine returns BIT over the wire as []byte/unsigned, so skip result check here
137138
SkipResultCheckOnServerEngine: true,
138139
},
139140
},
@@ -183,8 +184,8 @@ var ScriptTests = []ScriptTest{
183184
WHERE archived = FALSE AND id <> 1
184185
) AS dummy_alias`,
185186
Expected: []sql.Row{
186-
{int64(5), int64(1), "Card1", int64(0), uint64(0), int64(2)},
187-
{int64(7), int64(2), "Collection1", int64(0), nil, int64(2)},
187+
{int64(5), int64(1), "Card1", uint64(0), int64(0), int64(2)},
188+
{int64(7), int64(2), "Collection1", uint64(0), nil, int64(2)},
188189
},
189190
SkipResultCheckOnServerEngine: true,
190191
},

sql/expression/convert.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ 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+
}
126129
if types.IsUnsigned(l) && types.IsUnsigned(r) {
127130
return ConvertToUnsigned
128131
}

sql/plan/set_op.go

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

2121
"github.com/dolthub/go-mysql-server/sql"
22+
"github.com/dolthub/go-mysql-server/sql/types"
2223
)
2324

2425
const (
@@ -100,6 +101,7 @@ func (s *SetOp) Schema() sql.Schema {
100101
for i := range ls {
101102
c := *ls[i]
102103
if i < len(rs) {
104+
c.Type = types.GeneralizeTypes(ls[i].Type, rs[i].Type)
103105
c.Nullable = ls[i].Nullable || rs[i].Nullable
104106
}
105107
ret[i] = &c

0 commit comments

Comments
 (0)