diff --git a/runtime/sam/expr/agg/fuser.go b/runtime/sam/expr/agg/fuser.go index 873ada9ba..cbc29b1af 100644 --- a/runtime/sam/expr/agg/fuser.go +++ b/runtime/sam/expr/agg/fuser.go @@ -132,8 +132,8 @@ func (f *Fuser) fuseMono(typ super.Type) super.Type { switch typ := typ.(type) { case *super.TypeRecord: fields := slices.Clone(typ.Fields) - for _, field := range fields { - field.Type = f.fuseMono(field.Type) + for i, field := range fields { + fields[i].Type = f.fuseMono(field.Type) } out = f.sctx.MustLookupTypeRecord(fields) case *super.TypeArray: diff --git a/runtime/ztests/op/aggregate/fuse.yaml b/runtime/ztests/op/aggregate/fuse.yaml index bf3bad299..0ac3f0e31 100644 --- a/runtime/ztests/op/aggregate/fuse.yaml +++ b/runtime/ztests/op/aggregate/fuse.yaml @@ -28,3 +28,17 @@ input: | output: | <{fixed:{x:int64},var:fusion({s:string,a?:[int64],t?:fusion(int64|{x:int64})})}> + +--- + +spq: fuse(this) + +vector: true + +input: | + {a:[1,2]} + {a:["foo"]} + {a:[null]} + +output: | + <{a:fusion([fusion(int64|string|null)])}> diff --git a/runtime/ztests/op/blend.yaml b/runtime/ztests/op/blend.yaml index b83200521..5997a4591 100644 --- a/runtime/ztests/op/blend.yaml +++ b/runtime/ztests/op/blend.yaml @@ -109,6 +109,22 @@ spq: blend vector: true +input: | + {a:[1,2]} + {a:["foo"]} + {a:[null]} + +output: | + {a:[1,2]::[int64|string|null]} + {a:["foo"]::[int64|string|null]} + {a:[null]::[int64|string|null]} + +--- + +spq: blend + +vector: true + input: | 1::=p1 {a:1::=r1}::=r2 diff --git a/runtime/ztests/op/fuse.yaml b/runtime/ztests/op/fuse.yaml index 573dcc8d4..e579abde8 100644 --- a/runtime/ztests/op/fuse.yaml +++ b/runtime/ztests/op/fuse.yaml @@ -109,6 +109,22 @@ spq: fuse vector: true +input: | + {a:[1,2]} + {a:["foo"]} + {a:[null]} + +output: | + {a:fusion([fusion(1::(int64|string|null),),fusion(2::(int64|string|null),)],<[int64]>)} + {a:fusion([fusion("foo"::(int64|string|null),)],<[string]>)} + {a:fusion([fusion(null::(int64|string|null),)],<[null]>)} + +--- + +spq: fuse + +vector: true + input: | 1::=p1 {a:1::=r1}::=r2