Skip to content

Commit 0f2ddc4

Browse files
authored
vam: Fix casting on const null (#5471)
1 parent 90b9ef5 commit 0f2ddc4

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

runtime/vam/expr/cast/cast.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ func assemble(zctx *super.Context, vec vector.Any, typ super.Type, fn caster) ve
7272
}
7373

7474
func castConst(zctx *super.Context, vec *vector.Const, typ super.Type) vector.Any {
75+
if vec.Type().ID() == super.IDNull {
76+
return vector.NewConst(super.NewValue(typ, nil), vec.Len(), nil)
77+
}
7578
val := samexpr.LookupPrimitiveCaster(zctx, typ).Eval(samexpr.NewContext(), vec.Value())
7679
if val.IsError() {
7780
if vec.Nulls != nil {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
zed: |
2+
yield uint64(this), int64(this), float64(this), bool(this), bytes(this),
3+
string(this), ip(this), net(this), type(null)
4+
5+
vector: true
6+
7+
input: |
8+
null
9+
10+
output: |
11+
null(uint64)
12+
null(int64)
13+
null(float64)
14+
null(bool)
15+
null(bytes)
16+
null(string)
17+
null(ip)
18+
null(net)
19+
null(type)

0 commit comments

Comments
 (0)