Skip to content

Usage of Geo-Index in AQL FILTER leads to false results #5303

Closed
@mvollmary

Description

@mvollmary

my environment running ArangoDB

I'm using the latest ArangoDB of the respective release series:

  • self-compiled devel branch

Mode:

  • Cluster
  • Single-Server

Storage-Engine:

  • mmfiles
  • rocksdb

On this operating system:

  • Linux
    • Ubuntu .deb

this is an Geo-index related issue:

test data set

collection customer, geo index on field location:

[{"_key":"271","_id":"customer/271","_rev":"_WyQeHIC--_","nestedCustomers":[{"alive":false,"surname":"","_rev":"_WyQeHHO--_","name":"","nestedCustomer":{"alive":false,"surname":"","_rev":"_WyQeHHG--_","name":"","shoppingCart":"shopping-cart/257","_id":"customer/259","_key":"259","age":0},"_id":"customer/263","_key":"263","age":0},{"alive":false,"surname":"","_rev":"_WyQeHI---B","name":"","nestedCustomer":{"alive":false,"surname":"","name":"","age":0},"_id":"customer/269","_key":"269","age":0}],"alive":false,"surname":"","name":"","_class":"com.arangodb.springframework.testdata.Customer","age":0},{"_key":"259","_id":"customer/259","_rev":"_WyQeHHG--_","alive":false,"surname":"","name":"","shoppingCart":"shopping-cart/257","_class":"com.arangodb.springframework.testdata.Customer","age":0},{"_key":"261","_id":"customer/261","_rev":"_WyQeHHK--_","alive":false,"surname":"","name":"","nestedCustomer":{"alive":false,"surname":"","_rev":"_WyQeHG6--_","name":"","shoppingCart":"shopping-cart/241","_id":"customer/251","_key":"251","age":0},"_class":"com.arangodb.springframework.testdata.Customer","age":0},{"_key":"263","_id":"customer/263","_rev":"_WyQeHHO--_","alive":false,"surname":"","name":"","nestedCustomer":{"alive":false,"surname":"","_rev":"_WyQeHHG--_","name":"","shoppingCart":"shopping-cart/257","_id":"customer/259","_key":"259","age":0},"_class":"com.arangodb.springframework.testdata.Customer","age":0},{"_key":"265","_id":"customer/265","_rev":"_WyQeHIO--_","nestedCustomers":[{"alive":false,"surname":"","_rev":"_WyQeHHK--_","name":"","nestedCustomer":{"alive":false,"surname":"","_rev":"_WyQeHG6--_","name":"","shoppingCart":"shopping-cart/241","_id":"customer/251","_key":"251","age":0},"_id":"customer/261","_key":"261","age":0},{"alive":false,"surname":"","_rev":"_WyQeHHO--_","name":"","nestedCustomer":{"alive":false,"surname":"","_rev":"_WyQeHHG--_","name":"","shoppingCart":"shopping-cart/257","_id":"customer/259","_key":"259","age":0},"_id":"customer/263","_key":"263","age":0}],"alive":false,"surname":"","name":"","_class":"com.arangodb.springframework.testdata.Customer","age":0},{"_key":"251","_id":"customer/251","_rev":"_WyQeHG6--_","alive":false,"surname":"","name":"","shoppingCart":"shopping-cart/241","_class":"com.arangodb.springframework.testdata.Customer","age":0},{"_key":"269","_id":"customer/269","_rev":"_WyQeHI---B","alive":false,"surname":"","name":"","nestedCustomer":{"alive":false,"surname":"","name":"","age":0},"_class":"com.arangodb.springframework.testdata.Customer","age":0}]

collection product:

[{"_key":"253","_id":"product/253","_rev":"_WyQeHH---_","name":"3","location":[40,62],"_class":"com.arangodb.springframework.testdata.Product"},{"_key":"255","_id":"product/255","_rev":"_WyQeHHC--_","name":"4","location":[50,52],"_class":"com.arangodb.springframework.testdata.Product"},{"_key":"232","_id":"product/232","_rev":"_WyQeHFa--_","name":"asdf1","location":[10,12],"_class":"com.arangodb.springframework.testdata.Product"},{"_key":"234","_id":"product/234","_rev":"_WyQeHFu--_","name":"2","location":[30,42],"_class":"com.arangodb.springframework.testdata.Product"}]

collection shopping-cart:

[{"_key":"267","_id":"shopping-cart/267","_rev":"_WyQeHI---_","_class":"com.arangodb.springframework.testdata.ShoppingCart","products":["product/234","product/253","product/255"]},{"_key":"241","_id":"shopping-cart/241","_rev":"_WyQeHGO--_","_class":"com.arangodb.springframework.testdata.ShoppingCart","products":["product/232","product/234"]},{"_key":"257","_id":"shopping-cart/257","_rev":"_WyQeHHC--B","_class":"com.arangodb.springframework.testdata.ShoppingCart","products":["product/253","product/255"]}]

query

FOR e IN customer 
  FOR e1 IN TO_ARRAY(e.nestedCustomers) 
      FOR e2 IN `shopping-cart` 
        FILTER e2._id == e1.nestedCustomer.shoppingCart 
        FOR e3 IN product 
          FILTER e3._id IN e2.products 
          LET a = distance(e3.location[0], e3.location[1], 2, 1) <= 2779873.1661139685                        
          FILTER a
          RETURN a

The result will be empty [], but if you remove FILTER a you will get:

[
  false,
  false,
  false,
  true,
  false,
  false
]

I expect the query, with activated FILTER, to return:

[
  true
]

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions