MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestGetVector

Function TestGetVector

query/vector/vector_test.go:824–885  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

822}
823
824func TestGetVector(t *testing.T) {
825 setSchema("vectorNonIndex : float32vector .")
826
827 rdfs := `
828 <1> <vectorNonIndex> "[1.0, 1.0, 2.0, 2.0]" .
829 <2> <vectorNonIndex> "[2.0, 1.0, 2.0, 2.0]" .`
830 require.NoError(t, addTriplesToCluster(rdfs))
831
832 query := `
833 {
834 me(func: has(vectorNonIndex)) {
835 a as vectorNonIndex
836 }
837 aggregation() {
838 avg(val(a))
839 sum(val(a))
840 }
841 }
842 `
843 js := processQueryNoErr(t, query)
844 k := `{
845 "data": {
846 "me": [
847 {
848 "vectorNonIndex": [
849 1,
850 1,
851 2,
852 2
853 ]
854 },
855 {
856 "vectorNonIndex": [
857 2,
858 1,
859 2,
860 2
861 ]
862 }
863 ],
864 "aggregation": [
865 {
866 "avg(val(a))": [
867 1.5,
868 1,
869 2,
870 2
871 ]
872 },
873 {
874 "sum(val(a))": [
875 3,
876 2,
877 4,
878 4
879 ]
880 }
881 ]

Callers

nothing calls this directly

Calls 3

setSchemaFunction · 0.70
addTriplesToClusterFunction · 0.70
processQueryNoErrFunction · 0.70

Tested by

no test coverage detected