diff --git a/connor/connor.go b/connor/connor.go index fc47540a68..464e6b022f 100644 --- a/connor/connor.go +++ b/connor/connor.go @@ -2,13 +2,11 @@ package connor import ( "fmt" - - "github.com/sourcenetwork/defradb/core" ) // Match is the default method used in Connor to match some data to a // set of conditions. -func Match(conditions map[FilterKey]interface{}, data core.Doc) (bool, error) { +func Match(conditions map[FilterKey]interface{}, data interface{}) (bool, error) { return eq(conditions, data) } diff --git a/query/graphql/mapper/mapper.go b/query/graphql/mapper/mapper.go index f1831d634b..001f7ce750 100644 --- a/query/graphql/mapper/mapper.go +++ b/query/graphql/mapper/mapper.go @@ -134,12 +134,15 @@ func resolveAggregates( fieldDesc, isField := desc.GetField(target.hostExternalName) if isField && !fieldDesc.IsObject() { // If the hostExternalName matches a non-object field - // we can just take it as a field-requestable as only - // objects are targetable-requestables. + // we don't have to search for it and can just construct the + // targeting info here. hasHost = true - host = &Field{ - Index: int(fieldDesc.ID), - Name: target.hostExternalName, + host = &Targetable{ + Field: Field{ + Index: int(fieldDesc.ID), + Name: target.hostExternalName, + }, + Filter: ToFilter(target.filter, mapping), } } else { childObjectIndex := mapping.FirstIndexOfName(target.hostExternalName) @@ -828,7 +831,7 @@ func toOrderBy(source *parserTypes.OrderBy, mapping *core.DocumentMapping) *Orde // RunFilter runs the given filter expression // using the document, and evaluates. -func RunFilter(doc core.Doc, filter *Filter) (bool, error) { +func RunFilter(doc interface{}, filter *Filter) (bool, error) { if filter == nil { return true, nil } diff --git a/query/graphql/mapper/targetable.go b/query/graphql/mapper/targetable.go index 0de68643e0..c0d9598cfa 100644 --- a/query/graphql/mapper/targetable.go +++ b/query/graphql/mapper/targetable.go @@ -151,3 +151,7 @@ func (t *Targetable) cloneTo(index int) *Targetable { OrderBy: t.OrderBy, } } + +func (t *Targetable) AsTargetable() (*Targetable, bool) { + return t, true +} diff --git a/query/graphql/planner/count.go b/query/graphql/planner/count.go index a5a4f7d33e..ee5898a641 100644 --- a/query/graphql/planner/count.go +++ b/query/graphql/planner/count.go @@ -98,14 +98,54 @@ func (n *countNode) Next() (bool, error) { switch v.Kind() { // v.Len will panic if v is not one of these types, we don't want it to panic case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String: - length := v.Len() - // For now, we only support count filters internally to support averages - // so this is fine here now, but may need to be moved later once external - // count filter support is added. - if count > 0 && source.Filter != nil { - docArray, isDocArray := property.([]core.Doc) - if isDocArray { - for _, doc := range docArray { + if source.Filter != nil { + switch array := property.(type) { + case []core.Doc: + for _, doc := range array { + passed, err := mapper.RunFilter(doc, source.Filter) + if err != nil { + return false, err + } + if passed { + count += 1 + } + } + + case []bool: + for _, doc := range array { + passed, err := mapper.RunFilter(doc, source.Filter) + if err != nil { + return false, err + } + if passed { + count += 1 + } + } + + case []int64: + for _, doc := range array { + passed, err := mapper.RunFilter(doc, source.Filter) + if err != nil { + return false, err + } + if passed { + count += 1 + } + } + + case []float64: + for _, doc := range array { + passed, err := mapper.RunFilter(doc, source.Filter) + if err != nil { + return false, err + } + if passed { + count += 1 + } + } + + case []string: + for _, doc := range array { passed, err := mapper.RunFilter(doc, source.Filter) if err != nil { return false, err @@ -116,7 +156,7 @@ func (n *countNode) Next() (bool, error) { } } } else { - count = count + length + count = count + v.Len() } } } diff --git a/query/graphql/planner/sum.go b/query/graphql/planner/sum.go index 13d144ed1c..7b1112212b 100644 --- a/query/graphql/planner/sum.go +++ b/query/graphql/planner/sum.go @@ -223,10 +223,24 @@ func (n *sumNode) Next() (bool, error) { } case []int64: for _, childItem := range childCollection { + passed, err := mapper.RunFilter(childItem, source.Filter) + if err != nil { + return false, err + } + if !passed { + continue + } sum += float64(childItem) } case []float64: for _, childItem := range childCollection { + passed, err := mapper.RunFilter(childItem, source.Filter) + if err != nil { + return false, err + } + if !passed { + continue + } sum += childItem } } diff --git a/query/graphql/schema/generate.go b/query/graphql/schema/generate.go index 9ce3f4e031..99c282ecfd 100644 --- a/query/graphql/schema/generate.go +++ b/query/graphql/schema/generate.go @@ -291,15 +291,28 @@ func (g *Generator) createExpandedFieldAggregate( ) { for _, aggregateTarget := range f.Args { target := aggregateTarget.Name() - var targetType string + var filterTypeName string if target == parserTypes.GroupFieldName { - targetType = obj.Name() + filterTypeName = obj.Name() + "FilterArg" } else { - targetType = obj.Fields()[target].Type.Name() + filterType := obj.Fields()[target].Type + if list, isList := filterType.(*gql.List); isList && gql.IsLeafType(list.OfType) { + // If it is a list of leaf types - the filter is just the set of OperatorBlocks + // that are supported by this type - there can be no field selections. + if notNull, isNotNull := list.OfType.(*gql.NonNull); isNotNull { + // GQL does not support '!' in type names, and so we have to manipulate the + // underlying name like this if it is a nullable type. + filterTypeName = fmt.Sprintf("NotNull%sOperatorBlock", notNull.OfType.Name()) + } else { + filterTypeName = genTypeName(list.OfType, "OperatorBlock") + } + } else { + filterTypeName = filterType.Name() + "FilterArg" + } } expandedField := &gql.InputObjectFieldConfig{ - Type: g.manager.schema.TypeMap()[targetType+"FilterArg"], + Type: g.manager.schema.TypeMap()[filterTypeName], } aggregateTarget.Type.(*gql.InputObject).AddFieldConfig("filter", expandedField) } diff --git a/query/graphql/schema/manager.go b/query/graphql/schema/manager.go index f0d35e16a2..a9911b0777 100644 --- a/query/graphql/schema/manager.go +++ b/query/graphql/schema/manager.go @@ -146,11 +146,15 @@ func defaultTypes() []gql.Type { // Filter scalar blocks booleanOperatorBlock, + notNullBooleanOperatorBlock, dateTimeOperatorBlock, floatOperatorBlock, + notNullFloatOperatorBlock, idOperatorBlock, intOperatorBlock, + notNullIntOperatorBlock, stringOperatorBlock, + notNullstringOperatorBlock, schemaTypes.CommitLinkObject, schemaTypes.CommitObject, diff --git a/query/graphql/schema/root.go b/query/graphql/schema/root.go index e1d44a32e8..fc844f4722 100644 --- a/query/graphql/schema/root.go +++ b/query/graphql/schema/root.go @@ -49,6 +49,25 @@ var booleanOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ }, }) +// notNullBooleanOperatorBlock filter block for boolean! types. +var notNullBooleanOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ + Name: "NotNullBooleanOperatorBlock", + Fields: gql.InputObjectConfigFieldMap{ + "_eq": &gql.InputObjectFieldConfig{ + Type: gql.Boolean, + }, + "_ne": &gql.InputObjectFieldConfig{ + Type: gql.Boolean, + }, + "_in": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.Boolean)), + }, + "_nin": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.Boolean)), + }, + }, +}) + // dateTimeOperatorBlock filter block for DateTime types. var dateTimeOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ Name: "DateTimeOperatorBlock", @@ -111,6 +130,37 @@ var floatOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ }, }) +// notNullFloatOperatorBlock filter block for Float! types. +var notNullFloatOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ + Name: "NotNullFloatOperatorBlock", + Fields: gql.InputObjectConfigFieldMap{ + "_eq": &gql.InputObjectFieldConfig{ + Type: gql.Float, + }, + "_ne": &gql.InputObjectFieldConfig{ + Type: gql.Float, + }, + "_gt": &gql.InputObjectFieldConfig{ + Type: gql.Float, + }, + "_ge": &gql.InputObjectFieldConfig{ + Type: gql.Float, + }, + "_lt": &gql.InputObjectFieldConfig{ + Type: gql.Float, + }, + "_le": &gql.InputObjectFieldConfig{ + Type: gql.Float, + }, + "_in": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.Float)), + }, + "_nin": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.Float)), + }, + }, +}) + // intOperatorBlock filter block for Int types. var intOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ Name: "IntOperatorBlock", @@ -142,6 +192,37 @@ var intOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ }, }) +// notNullIntOperatorBlock filter block for Int! types. +var notNullIntOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ + Name: "NotNullIntOperatorBlock", + Fields: gql.InputObjectConfigFieldMap{ + "_eq": &gql.InputObjectFieldConfig{ + Type: gql.Int, + }, + "_ne": &gql.InputObjectFieldConfig{ + Type: gql.Int, + }, + "_gt": &gql.InputObjectFieldConfig{ + Type: gql.Int, + }, + "_ge": &gql.InputObjectFieldConfig{ + Type: gql.Int, + }, + "_lt": &gql.InputObjectFieldConfig{ + Type: gql.Int, + }, + "_le": &gql.InputObjectFieldConfig{ + Type: gql.Int, + }, + "_in": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.Int)), + }, + "_nin": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.Int)), + }, + }, +}) + // stringOperatorBlock filter block for string types. var stringOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ Name: "StringOperatorBlock", @@ -164,6 +245,25 @@ var stringOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ }, }) +// notNullstringOperatorBlock filter block for string! types. +var notNullstringOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ + Name: "NotNullStringOperatorBlock", + Fields: gql.InputObjectConfigFieldMap{ + "_eq": &gql.InputObjectFieldConfig{ + Type: gql.String, + }, + "_ne": &gql.InputObjectFieldConfig{ + Type: gql.String, + }, + "_in": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.String)), + }, + "_nin": &gql.InputObjectFieldConfig{ + Type: gql.NewList(gql.NewNonNull(gql.String)), + }, + }, +}) + // idOperatorBlock filter block for ID types. var idOperatorBlock = gql.NewInputObject(gql.InputObjectConfig{ Name: "IDOperatorBlock", diff --git a/tests/integration/query/inline_array/with_average_filter_test.go b/tests/integration/query/inline_array/with_average_filter_test.go new file mode 100644 index 0000000000..7f237c0354 --- /dev/null +++ b/tests/integration/query/inline_array/with_average_filter_test.go @@ -0,0 +1,73 @@ +// Copyright 2022 Democratized Data Foundation +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package inline_array + +import ( + "testing" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestQueryInlineIntegerArrayWithAverageWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered average of integer array", + Query: `query { + users { + Name + _avg(FavouriteIntegers: {filter: {_gt: 0}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "FavouriteIntegers": [-1, 2, -1, 1, 0] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_avg": float64(1.5), + }, + }, + } + + executeTestCase(t, test) +} + +func TestQueryInlineFloatArrayWithAverageWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered average of float array", + Query: `query { + users { + Name + _avg(FavouriteFloats: {filter: {_lt: 9}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "FavouriteFloats": [3.4, 3.6, 10] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_avg": 3.5, + }, + }, + } + + executeTestCase(t, test) +} diff --git a/tests/integration/query/inline_array/with_average_test.go b/tests/integration/query/inline_array/with_average_test.go index df918c4f9b..8bbd9d664c 100644 --- a/tests/integration/query/inline_array/with_average_test.go +++ b/tests/integration/query/inline_array/with_average_test.go @@ -16,7 +16,7 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -func TestQueryInlineIntegerArrayWithsWithAverageAndNullArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithAverageAndNullArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of nil integer array", Query: `query { @@ -43,7 +43,7 @@ func TestQueryInlineIntegerArrayWithsWithAverageAndNullArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithAverageAndEmptyArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithAverageAndEmptyArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of empty integer array", Query: `query { @@ -70,7 +70,7 @@ func TestQueryInlineIntegerArrayWithsWithAverageAndEmptyArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithAverageAndZeroArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithAverageAndZeroArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of zero integer array", Query: `query { @@ -97,7 +97,7 @@ func TestQueryInlineIntegerArrayWithsWithAverageAndZeroArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithAverageAndPopulatedArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithAverageAndPopulatedArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of populated integer array", Query: `query { @@ -124,7 +124,7 @@ func TestQueryInlineIntegerArrayWithsWithAverageAndPopulatedArray(t *testing.T) executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithAverageAndNullArray(t *testing.T) { +func TestQueryInlineFloatArrayWithAverageAndNullArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of nil float array", Query: `query { @@ -151,7 +151,7 @@ func TestQueryInlineFloatArrayWithsWithAverageAndNullArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithAverageAndEmptyArray(t *testing.T) { +func TestQueryInlineFloatArrayWithAverageAndEmptyArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of empty float array", Query: `query { @@ -178,7 +178,7 @@ func TestQueryInlineFloatArrayWithsWithAverageAndEmptyArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithAverageAndZeroArray(t *testing.T) { +func TestQueryInlineFloatArrayWithAverageAndZeroArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of zero float array", Query: `query { @@ -205,7 +205,7 @@ func TestQueryInlineFloatArrayWithsWithAverageAndZeroArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithAverageAndPopulatedArray(t *testing.T) { +func TestQueryInlineFloatArrayWithAverageAndPopulatedArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, average of populated float array", Query: `query { diff --git a/tests/integration/query/inline_array/with_count_filter_test.go b/tests/integration/query/inline_array/with_count_filter_test.go new file mode 100644 index 0000000000..968c45d3ae --- /dev/null +++ b/tests/integration/query/inline_array/with_count_filter_test.go @@ -0,0 +1,129 @@ +// Copyright 2022 Democratized Data Foundation +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package inline_array + +import ( + "testing" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestQueryInlineBoolArrayWithCountWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered count of bool array", + Query: `query { + users { + Name + _count(LikedIndexes: {filter: {_eq: true}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "LikedIndexes": [true, true, false, true] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_count": 3, + }, + }, + } + + executeTestCase(t, test) +} + +func TestQueryInlineIntegerArrayWithCountWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered count of integer array", + Query: `query { + users { + Name + _count(FavouriteIntegers: {filter: {_gt: 0}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "FavouriteIntegers": [-1, 2, -1, 1, 0] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_count": 2, + }, + }, + } + + executeTestCase(t, test) +} + +func TestQueryInlineFloatArrayWithCountWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered count of float array", + Query: `query { + users { + Name + _count(FavouriteFloats: {filter: {_lt: 9}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "FavouriteFloats": [3.1425, 0.00000000001, 10] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_count": 2, + }, + }, + } + + executeTestCase(t, test) +} + +func TestQueryInlineStringArrayWithCountWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered count of string array", + Query: `query { + users { + Name + _count(PreferredStrings: {filter: {_in: ["", "the first"]}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "PreferredStrings": ["", "the previous", "the first", "empty string"] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_count": 2, + }, + }, + } + + executeTestCase(t, test) +} diff --git a/tests/integration/query/inline_array/with_count_test.go b/tests/integration/query/inline_array/with_count_test.go index 099ad0c6c8..49592adda8 100644 --- a/tests/integration/query/inline_array/with_count_test.go +++ b/tests/integration/query/inline_array/with_count_test.go @@ -16,7 +16,7 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -func TestQueryInlineIntegerArrayWithsWithCountAndNullArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithCountAndNullArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, count of nil integer array", Query: `query { @@ -43,7 +43,7 @@ func TestQueryInlineIntegerArrayWithsWithCountAndNullArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithCountAndEmptyArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithCountAndEmptyArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, count of empty integer array", Query: `query { @@ -70,7 +70,7 @@ func TestQueryInlineIntegerArrayWithsWithCountAndEmptyArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithCountAndPopulatedArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithCountAndPopulatedArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, count of integer array", Query: `query { diff --git a/tests/integration/query/inline_array/with_sum_filter_test.go b/tests/integration/query/inline_array/with_sum_filter_test.go new file mode 100644 index 0000000000..0546473b83 --- /dev/null +++ b/tests/integration/query/inline_array/with_sum_filter_test.go @@ -0,0 +1,73 @@ +// Copyright 2022 Democratized Data Foundation +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package inline_array + +import ( + "testing" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestQueryInlineIntegerArrayWithSumWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered sum of integer array", + Query: `query { + users { + Name + _sum(FavouriteIntegers: {filter: {_gt: 0}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "FavouriteIntegers": [-1, 2, -1, 1, 0] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_sum": int64(3), + }, + }, + } + + executeTestCase(t, test) +} + +func TestQueryInlineFloatArrayWithSumWithFilter(t *testing.T) { + test := testUtils.QueryTestCase{ + Description: "Simple inline array, filtered sum of float array", + Query: `query { + users { + Name + _sum(FavouriteFloats: {filter: {_lt: 9}}) + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "Shahzad", + "FavouriteFloats": [3.1425, 0.00000000001, 10] + }`, + }, + }, + Results: []map[string]interface{}{ + { + "Name": "Shahzad", + "_sum": 3.14250000001, + }, + }, + } + + executeTestCase(t, test) +} diff --git a/tests/integration/query/inline_array/with_sum_test.go b/tests/integration/query/inline_array/with_sum_test.go index 033c789791..bb3ca90d25 100644 --- a/tests/integration/query/inline_array/with_sum_test.go +++ b/tests/integration/query/inline_array/with_sum_test.go @@ -16,7 +16,7 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -func TestQueryInlineIntegerArrayWithsWithSumAndNullArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithSumAndNullArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, sum of nil integer array", Query: `query { @@ -43,7 +43,7 @@ func TestQueryInlineIntegerArrayWithsWithSumAndNullArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithSumAndEmptyArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithSumAndEmptyArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, sum of empty integer array", Query: `query { @@ -70,7 +70,7 @@ func TestQueryInlineIntegerArrayWithsWithSumAndEmptyArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineIntegerArrayWithsWithSumAndPopulatedArray(t *testing.T) { +func TestQueryInlineIntegerArrayWithSumAndPopulatedArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, sum of integer array", Query: `query { @@ -97,7 +97,7 @@ func TestQueryInlineIntegerArrayWithsWithSumAndPopulatedArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithSumAndNullArray(t *testing.T) { +func TestQueryInlineFloatArrayWithSumAndNullArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, sum of nil float array", Query: `query { @@ -124,7 +124,7 @@ func TestQueryInlineFloatArrayWithsWithSumAndNullArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithSumAndEmptyArray(t *testing.T) { +func TestQueryInlineFloatArrayWithSumAndEmptyArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, sum of empty float array", Query: `query { @@ -151,7 +151,7 @@ func TestQueryInlineFloatArrayWithsWithSumAndEmptyArray(t *testing.T) { executeTestCase(t, test) } -func TestQueryInlineFloatArrayWithsWithSumAndPopulatedArray(t *testing.T) { +func TestQueryInlineFloatArrayWithSumAndPopulatedArray(t *testing.T) { test := testUtils.QueryTestCase{ Description: "Simple inline array with no filter, sum of float array", Query: `query {