Skip to content

Commit 4305371

Browse files
committed
getting closer to filter working
1 parent da5db0d commit 4305371

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

server/cast/text.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,18 @@ func textImplicit() {
7575
return handleStringCast(val.(string), targetType)
7676
},
7777
})
78+
framework.MustAddImplicitTypeCast(framework.TypeCast{
79+
FromType: pgtypes.Text,
80+
ToType: pgtypes.VarBit,
81+
Function: func(ctx *sql.Context, val any, targetType *pgtypes.DoltgresType) (any, error) {
82+
return targetType.IoInput(ctx, val.(string))
83+
},
84+
})
85+
framework.MustAddImplicitTypeCast(framework.TypeCast{
86+
FromType: pgtypes.Text,
87+
ToType: pgtypes.Bit,
88+
Function: func(ctx *sql.Context, val any, targetType *pgtypes.DoltgresType) (any, error) {
89+
return targetType.IoInput(ctx, val.(string))
90+
},
91+
})
7892
}

testing/go/adaptive_encoding_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ func TestAdaptiveEncodingVarbit(t *testing.T) {
253253
},
254254
{
255255
// An inlined adaptive column can be used in a filter.
256-
Query: "select i from blobt where b = LOAD_FILE('testdata/fullSizeVarbit')",
256+
Query: "select i from blobt where b = LOAD_FILE('testdata/fullSizeVarbit')::varbit",
257257
Expected: []sql.Row{{"F"}},
258258
},
259259
{
260260
// An out-of-line adaptive column can be used in a filter.
261-
Query: "select i from blobt where b = LOAD_FILE('testdata/halfSizeVarbit')",
261+
Query: "select i from blobt where b = LOAD_FILE('testdata/halfSizeVarbit')::varbit",
262262
Expected: []sql.Row{{"H"}},
263263
},
264264
},
@@ -297,12 +297,12 @@ func TestAdaptiveEncodingVarbit(t *testing.T) {
297297
},
298298
{
299299
// An adaptive column can be used in a filter when it doesn't have the same encoding in all rows.
300-
Query: "select i from blobt2 where b1 = LOAD_FILE('testdata/halfSize')",
300+
Query: "select i from blobt2 where b1 = LOAD_FILE('testdata/halfSizeVarbit')::varbit",
301301
Expected: []sql.Row{{"HF"}, {"HH"}, {"HT"}},
302302
},
303303
{
304304
// An adaptive column can be used in a filter when it doesn't have the same encoding in all rows.
305-
Query: "select i from blobt2 where b2 = LOAD_FILE('testdata/halfSize')",
305+
Query: "select i from blobt2 where b2 = LOAD_FILE('testdata/halfSizeVarbit')::varbit",
306306
Expected: []sql.Row{{"FH"}, {"HH"}, {"TH"}},
307307
},
308308
},

0 commit comments

Comments
 (0)