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

feat(query): Support for between func with count at root #6556

Merged
merged 14 commits into from
Sep 24, 2020
2 changes: 1 addition & 1 deletion gql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3318,7 +3318,7 @@ func isGeoFunc(name string) bool {

func IsInequalityFn(name string) bool {
switch name {
case "eq", "le", "ge", "gt", "lt":
case "eq", "le", "ge", "gt", "lt", "between":
return true
}
return false
Expand Down
18 changes: 18 additions & 0 deletions query/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ geometry : geo @index(geo) .
value : string @index(trigram) .
full_name : string @index(hash) .
nick_name : string @index(term) .
pet_name : [string] @index(exact) .
royal_title : string @index(hash, term, fulltext) @lang .
school : [uid] @count .
lossy : string @index(term) @lang .
Expand Down Expand Up @@ -315,6 +316,8 @@ noindex_dob : datetime .
noindex_alive : bool .
noindex_salary : float .
language : [string] .
score : [int] @index(int) .
average : [float] @index(float) .
`

func populateCluster() {
Expand Down Expand Up @@ -729,6 +732,21 @@ func populateCluster() {
<56> <connects> <58> (weight=1) .
<58> <connects> <59> (weight=1) .
<59> <connects> <60> (weight=1) .

# data for testing between operator.
<20000> <score> "90" .
<20000> <score> "56" .
<20000> <average> "46.93" .
<20000> <average> "55.10" .
<20000> <pet_name> "little master" .
<20000> <pet_name> "master blaster" .

<20001> <score> "68" .
<20001> <score> "85" .
<20001> <average> "35.20" .
<20001> <average> "49.33" .
<20001> <pet_name> "mahi" .
<20001> <pet_name> "ms" .
`)
if err != nil {
panic(fmt.Sprintf("Could not able add triple to the cluster. Got error %v", err.Error()))
Expand Down
2 changes: 1 addition & 1 deletion query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,7 @@ func isValidFuncName(f string) bool {

func isInequalityFn(f string) bool {
switch f {
case "eq", "le", "ge", "gt", "lt":
case "eq", "le", "ge", "gt", "lt", "between":
return true
}
return false
Expand Down
Loading