I have just run into an issue that I believe is a bug using Reverse
with Union
. This query seems to have been running fine for a while now and the issue was just spotted today. I am using Union
on Indexes
generated by a GraphQL schema and I have narrowed down the issue to wrong refs being returned when Reverse
is applied.
All of these Indexes
should return a property
ref, but with Reverse
applied I am now getting refs for property_guests
, property_editors
and property_members
. If I remove Reverse
the correct property
refs are returned.
Query:
Map(
Paginate(
Reverse(
Intersection(
Distinct(
Union(
Match(Index("property_owner_by_user"), Ref(Collection("users"), "xxxxx")),
Match(Index("property_editors_by_user"), Ref(Collection("users"), "xxxxx")),
Match(Index("property_guests_by_user"), Ref(Collection("users"), "xxxxx")),
Match(Index("property_members_by_user"), Ref(Collection("users"), "xxxxx"))
)
)
)
),
{ size: 10 }
),
Lambda("ref", Var("ref"))
)
Result:
{
after: [
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx")
],
data: [
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("property_guests"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx"),
Ref(Collection("properties"), "xxxxx")
]
}