Open edwardflo opened 4 years ago
@Simran-B Any observations or insights so far on this issue? Thx
Hi @Simran-B Any luck with this?
@Simran-B Sorry to bug you. Has anyone had a chance to look at this at all?
@Simran-B @jsteemann Could someone please give an update on this? This is something that is impacting our team as well. Is it still in analysis phase?
As explained on Slack by @gnusi, it is considered a bug that the query does not raise an error for such an unsupported query.
It is basically impossible to correctly process a query with a dependent sub-query. It's unclear what should be executed first: sub-query or main query. So the only possibility for now is to use FILTER.
FILTER always means post-processing, that's why it's perfectly valid to use dependent sub-queries. The SEARCH condition is a part of the EnumerateViewNode
in the execution plan, therefore it's unclear what should be done first (like the chicken or egg problem).
The underlying search engine already supports indexing the city
and country
fields with positions, so that you can ask it to find all documents where the positions of city
and country
match. It's not exposed in AQL yet, but this is how it could look like:
FOR d IN myView
SEARCH IS_SAME_POSITION(d.visits.country == 'Canada', d.visits.city == 'Paris')
RETURN d
The query would match:
{
visits : [ { country : "Canada", city: "Paris" }, { country: "Germany", city: "Cologne" } ]
}
but not:
{
visits : [ { country: "France", city: "Paris" }, { country: "Canada", city: "Toronto" } ]
}
My Environment
The AQL statements below should result in the same result. It looks for movie records where startYear = 1990 and genre = "Comedy". For each one found, it uses a subqiery to fetch records (from
title-principals-view
, an ArangoSearch view) for the same movie that have a category = "composer". When subquery is in the SEARCh block, it ignoresp.tconst == root._key
(as you can see in the profile) and the subquery is actually only executingp.category == "composer"
instead ofp.tconst == root._key AND p.category == "composer"
. It ends up returning all records intitle-principals-view
where category = "composer" (which is 1180041 records).When subquery is in the FILTER block, it works as expected.
Correlated subquery inside a SEARCH block
Result
Profile
Correlated subquery inside a FILTER block
Result
Profile