Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Do not implicit copy aggregate contexts. #97

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions functions/aggregates.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type _CountFunction struct {
Aggregator
}

func (self _CountFunction) Info(scope types.Scope, type_map *types.TypeMap) *types.FunctionInfo {
func (self *_CountFunction) Info(scope types.Scope, type_map *types.TypeMap) *types.FunctionInfo {
return &types.FunctionInfo{
Name: "count",
Doc: "Counts the items.",
Expand All @@ -93,7 +93,7 @@ func (self _CountFunction) Info(scope types.Scope, type_map *types.TypeMap) *typ
}
}

func (self _CountFunction) Call(
func (self *_CountFunction) Call(
ctx context.Context,
scope types.Scope,
args *ordereddict.Dict) types.Any {
Expand Down Expand Up @@ -138,7 +138,7 @@ func (self _SumFunction) Info(scope types.Scope, type_map *types.TypeMap) *types
}
}

func (self _SumFunction) Call(
func (self *_SumFunction) Call(
ctx context.Context,
scope types.Scope,
args *ordereddict.Dict) types.Any {
Expand Down Expand Up @@ -183,7 +183,7 @@ func (self _MinFunction) Info(scope types.Scope, type_map *types.TypeMap) *types
}
}

func (self _MinFunction) Call(
func (self *_MinFunction) Call(
ctx context.Context,
scope types.Scope,
args *ordereddict.Dict) types.Any {
Expand Down Expand Up @@ -219,7 +219,7 @@ func (self _MaxFunction) Info(scope types.Scope, type_map *types.TypeMap) *types
}
}

func (self _MaxFunction) Call(
func (self *_MaxFunction) Call(
ctx context.Context,
scope types.Scope,
args *ordereddict.Dict) types.Any {
Expand Down Expand Up @@ -258,7 +258,7 @@ func (self _EnumerateFunction) Info(scope types.Scope, type_map *types.TypeMap)
}
}

func (self _EnumerateFunction) Call(
func (self *_EnumerateFunction) Call(
ctx context.Context,
scope types.Scope,
args *ordereddict.Dict) types.Any {
Expand Down
13 changes: 8 additions & 5 deletions functions/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ func GetBuiltinFunctions() []types.FunctionInterface {
FormatFunction{},
_GetFunction{},
_EncodeFunction{},
_CountFunction{},
_SumFunction{},
_MinFunction{},
_MaxFunction{},
_EnumerateFunction{},

// Aggregate functions must not be implicitly copied. They are
// copied deliberately using vfilter.CopyFunction()
&_CountFunction{},
&_SumFunction{},
&_MinFunction{},
&_MaxFunction{},
&_EnumerateFunction{},
FormatFunction{},
LenFunction{},
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/foreach.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (self _ForeachPluginImpl) Call(ctx context.Context,

// Create a worker pool to run the subquery in.
if arg.Workers > 1 {
scope.Log("Creating %v workers for foreach plugin\n", arg.Workers)
scope.Log("DEBUG:Creating %v workers for foreach plugin\n", arg.Workers)
}
pool := newWorkerPool(ctx, arg.Query, output_chan, int(arg.Workers))
defer pool.Close()
Expand Down
Loading