mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Renamed SumReduce back to Sum
This commit is contained in:
parent
ebee6e4deb
commit
90add3f64d
2 changed files with 9 additions and 9 deletions
14
executor.go
14
executor.go
|
|
@ -161,9 +161,9 @@ func (e *Executor) executeCall(ctx context.Context, index string, c *pql.Call, s
|
|||
indexTag := fmt.Sprintf("index:%s", index)
|
||||
// Special handling for mutation and top-n calls.
|
||||
switch c.Name {
|
||||
case "SumReduce":
|
||||
case "Sum":
|
||||
e.Holder.Stats.CountWithCustomTags(c.Name, 1, 1.0, []string{indexTag})
|
||||
return e.executeSumReduce(ctx, index, c, slices, opt)
|
||||
return e.executeSum(ctx, index, c, slices, opt)
|
||||
case "ClearBit":
|
||||
return e.executeClearBit(ctx, index, c, opt)
|
||||
case "Count":
|
||||
|
|
@ -205,16 +205,16 @@ func (e *Executor) validateCallArgs(c *pql.Call) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// executeSumReduce executes a SumCount() call.
|
||||
func (e *Executor) executeSumReduce(ctx context.Context, index string, c *pql.Call, slices []uint64, opt *ExecOptions) (SumCount, error) {
|
||||
// executeSum executes a Sum() call.
|
||||
func (e *Executor) executeSum(ctx context.Context, index string, c *pql.Call, slices []uint64, opt *ExecOptions) (SumCount, error) {
|
||||
if frame, _ := c.Args["frame"]; frame == "" {
|
||||
return SumCount{}, errors.New("SumReduce(): frame required")
|
||||
return SumCount{}, errors.New("Sum(): frame required")
|
||||
} else if field, _ := c.Args["field"]; field == "" {
|
||||
return SumCount{}, errors.New("SumReduce(): field required")
|
||||
return SumCount{}, errors.New("Sum(): field required")
|
||||
}
|
||||
|
||||
if len(c.Children) > 1 {
|
||||
return SumCount{}, errors.New("SumReduce() only accepts a single bitmap input")
|
||||
return SumCount{}, errors.New("Sum() only accepts a single bitmap input")
|
||||
}
|
||||
|
||||
// Execute calls in bulk on each remote node and merge.
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ func TestExecutor_Execute_SumReduce(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("NoFilter", func(t *testing.T) {
|
||||
if result, err := e.Execute(context.Background(), "i", test.MustParse(`SumReduce(frame=f, field=foo)`), nil, nil); err != nil {
|
||||
if result, err := e.Execute(context.Background(), "i", test.MustParse(`Sum(frame=f, field=foo)`), nil, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !reflect.DeepEqual(result[0], pilosa.SumCount{Sum: 200, Count: 5}) {
|
||||
t.Fatalf("unexpected result: %s", spew.Sdump(result))
|
||||
|
|
@ -653,7 +653,7 @@ func TestExecutor_Execute_SumReduce(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("WithFilter", func(t *testing.T) {
|
||||
if result, err := e.Execute(context.Background(), "i", test.MustParse(`SumReduce(Bitmap(frame=f, rowID=0), frame=f, field=foo)`), nil, nil); err != nil {
|
||||
if result, err := e.Execute(context.Background(), "i", test.MustParse(`Sum(Bitmap(frame=f, rowID=0), frame=f, field=foo)`), nil, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !reflect.DeepEqual(result[0], pilosa.SumCount{Sum: 80, Count: 2}) {
|
||||
t.Fatalf("unexpected result: %s", spew.Sdump(result))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue