diff --git a/runtime/vam/expr/logic.go b/runtime/vam/expr/logic.go index 941527a4d0..56618a49ce 100644 --- a/runtime/vam/expr/logic.go +++ b/runtime/vam/expr/logic.go @@ -201,17 +201,20 @@ func FlattenBool(vec vector.Any) *vector.Bool { } type In struct { - lhs Evaluator - rhs Evaluator - pw *PredicateWalk + lhs Evaluator + rhs Evaluator + defuse *Defuse + pw *PredicateWalk } func NewIn(sctx *super.Context, lhs, rhs Evaluator) *In { - return &In{lhs, rhs, NewPredicateWalk(sctx, NewCompare(sctx, "==", nil, nil).eval)} + return &In{lhs, rhs, NewDefuse(sctx), NewPredicateWalk(sctx, NewCompare(sctx, "==", nil, nil).eval)} } func (i *In) Eval(this vector.Any) vector.Any { - return vector.Apply(vector.ApplyRipUnions, i.eval, i.lhs.Eval(this), i.rhs.Eval(this)) + lhs := i.defuse.Eval(i.lhs.Eval(this)) + rhs := i.defuse.Eval(i.rhs.Eval(this)) + return vector.Apply(vector.ApplyRipUnions, i.eval, lhs, rhs) } func (i *In) eval(vecs ...vector.Any) vector.Any { diff --git a/runtime/ztests/expr/in.yaml b/runtime/ztests/expr/in.yaml index 7b7f5aebae..c465898b16 100644 --- a/runtime/ztests/expr/in.yaml +++ b/runtime/ztests/expr/in.yaml @@ -73,6 +73,7 @@ input: | "b"::enum(b,c) "b"::enum(b,d) [{a:1},[2],set[3],map{4:4},"b"::enum(b,c)] + fusion([fusion(2::(int64|{a:int64}),)],<[int64]>) output: | true @@ -86,6 +87,7 @@ output: | true false true + true ---