diff --git a/dgraphtest/config.go b/dgraphtest/config.go index ded018d201b..76a988432e6 100644 --- a/dgraphtest/config.go +++ b/dgraphtest/config.go @@ -74,9 +74,8 @@ func AllUpgradeCombos(v20 bool) []UpgradeCombo { // In mainCombos list, we keep latest version to current HEAD as well as // older versions of dgraph to ensure that a change does not cause failures. mainCombos := []UpgradeCombo{ - {"v23.0.1", localVersion, BackupRestore}, - {"v23.0.1", localVersion, InPlace}, - {"v21.03.0", "4fc9cfd", BackupRestore}, + {"v23.1.0", localVersion, BackupRestore}, + {"v23.1.0", localVersion, InPlace}, } if v20 { diff --git a/query/common_test.go b/query/common_test.go index ea914bbb24f..83f411506f3 100644 --- a/query/common_test.go +++ b/query/common_test.go @@ -264,6 +264,14 @@ type Speaker { language } +type User { + name + password + gender + friend + alive +} + name : string @index(term, exact, trigram) @count @lang . name_lang : string @lang . lang_type : string @index(exact) . @@ -337,7 +345,6 @@ tweet-c : string @index(fulltext) . tweet-d : string @index(trigram) . name2 : string @index(term) . age2 : int @index(int) . -vectorNonIndex : float32vector . ` func populateCluster(dc dgraphtest.Cluster) { @@ -348,32 +355,30 @@ func populateCluster(dc dgraphtest.Cluster) { // all the UIDs we are using during the tests. x.Panic(dc.AssignUids(client.Dgraph, 65536)) - higher, err := dgraphtest.IsHigherVersion(dc.GetVersion(), "160a0faa5fc6233fdc5a4caa4a7a3d1591f460d0") - x.Panic(err) - var ts string - if higher { - ts = testSchema + `type User { - name - password - gender - friend - alive - user_profile - } - user_profile : float32vector @index(hnsw(metric:"euclidian")) .` - } else { - ts = testSchema + `type User { - name - password - gender - friend - alive - }` - } - setSchema(ts) - err = addTriplesToCluster(` - <1> "[1.0, 1.0, 2.0, 2.0]" . - <2> "[2.0, 1.0, 2.0, 2.0]" . + // higher, err := dgraphtest.IsHigherVersion(dc.GetVersion(), "160a0faa5fc6233fdc5a4caa4a7a3d1591f460d0") + // x.Panic(err) + // var ts string + // if higher { + // ts = testSchema + `type User { + // name + // password + // gender + // friend + // alive + // user_profile + // } + // user_profile : float32vector @index(hnsw(metric:"euclidian")) .` + // } else { + // ts = testSchema + `type User { + // name + // password + // gender + // friend + // alive + // }` + // } + setSchema(testSchema) + err := addTriplesToCluster(` <1> "Michonne" . <2> "King Lear" . <3> "Margaret" . diff --git a/query/query0_test.go b/query/query0_test.go index 80739311d7f..d5b4b610684 100644 --- a/query/query0_test.go +++ b/query/query0_test.go @@ -31,42 +31,6 @@ import ( "github.com/dgraph-io/dgraph/dql" ) -func TestGetVector(t *testing.T) { - query := ` - { - me(func: has(vectorNonIndex)) { - a as vectorNonIndex - } - aggregation() { - avg(val(a)) - sum(val(a)) - } - } - ` - js := processQueryNoErr(t, query) - k := `{ - "data": { - "me": [ - { - "vectorNonIndex": [1,1,2,2] - }, - { - "vectorNonIndex": [2,1,2,2] - } - ], - "aggregation": [ - { - "avg(val(a))": [1.5,1,2,2] - }, - { - "sum(val(a))": [3,2,4,4] - } - ] - } -}` - require.JSONEq(t, k, js) -} - func TestGetUID(t *testing.T) { query := ` { diff --git a/query/vector/vector_test.go b/query/vector/vector_test.go index 2bd4554314e..23878f27284 100644 --- a/query/vector/vector_test.go +++ b/query/vector/vector_test.go @@ -727,3 +727,66 @@ func TestVectorTwoTxnWithoutCommit(t *testing.T) { require.Contains(t, resp, vectors[i]) } } + +func TestGetVector(t *testing.T) { + setSchema("vectorNonIndex : float32vector .") + + rdfs := ` + <1> "[1.0, 1.0, 2.0, 2.0]" . + <2> "[2.0, 1.0, 2.0, 2.0]" .` + require.NoError(t, addTriplesToCluster(rdfs)) + + query := ` + { + me(func: has(vectorNonIndex)) { + a as vectorNonIndex + } + aggregation() { + avg(val(a)) + sum(val(a)) + } + } + ` + js := processQueryNoErr(t, query) + k := `{ + "data": { + "me": [ + { + "vectorNonIndex": [ + 1, + 1, + 2, + 2 + ] + }, + { + "vectorNonIndex": [ + 2, + 1, + 2, + 2 + ] + } + ], + "aggregation": [ + { + "avg(val(a))": [ + 1.5, + 1, + 2, + 2 + ] + }, + { + "sum(val(a))": [ + 3, + 2, + 4, + 4 + ] + } + ] + } + }` + require.JSONEq(t, k, js) +}