From 292d0cc3993ab36747644f9711bd5496ef09a04e Mon Sep 17 00:00:00 2001 From: Mike Cohen Date: Wed, 27 Mar 2024 16:36:59 +1000 Subject: [PATCH] Properly materialize args to dict() --- functions/functions.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/functions/functions.go b/functions/functions.go index 65fa639..4c3190b 100644 --- a/functions/functions.go +++ b/functions/functions.go @@ -16,6 +16,7 @@ import ( "golang.org/x/text/transform" "www.velocidex.com/golang/vfilter/arg_parser" "www.velocidex.com/golang/vfilter/types" + "www.velocidex.com/golang/vfilter/utils/dict" ) // A helper function to build a dict within the query. @@ -30,17 +31,7 @@ func (self _DictFunc) Info(scope types.Scope, type_map *types.TypeMap) *types.Fu } func (self _DictFunc) Call(ctx context.Context, scope types.Scope, args *ordereddict.Dict) types.Any { - result := ordereddict.NewDict() - for _, k := range scope.GetMembers(args) { - v, _ := args.Get(k) - lazy_arg, ok := v.(types.LazyExpr) - if ok { - result.Set(k, lazy_arg.Reduce(ctx)) - } else { - result.Set(k, v) - } - } - return result + return dict.RowToDict(ctx, scope, args) } type _TimestampArg struct {