diff --git a/test/QueryPlannerTest.cpp b/test/QueryPlannerTest.cpp
index 8b05f89577..9b94b43ce0 100644
--- a/test/QueryPlannerTest.cpp
+++ b/test/QueryPlannerTest.cpp
@@ -1828,13 +1828,12 @@ TEST(QueryPlanner, SpatialJoinServicePayloadVars) {
}
TEST(QueryPlanner, SpatialJoinServiceMaxDistOutside) {
- // If only maxDistance is used but not numNearestNeighbors, the right variable
- // must not come from inside the SERVICE
-
auto scan = h::IndexScanFromStrings;
using V = Variable;
auto S2 = SpatialJoinAlgorithm::S2_GEOMETRY;
+ // If only maxDistance is used but not numNearestNeighbors, the right variable
+ // must not come from inside the SERVICE
h::expect(
"PREFIX spatialSearch:
", "?y"), scan("?a", "
", "?b")));
+
+ // If the user explicitly states that they want all payload variables (which
+ // is enforced and the default anyway), this should also work
+ h::expect(
+ "PREFIX spatialSearch:
?b ." + "?x
?y ." + "SERVICE spatialSearch: {" + "_:config spatialSearch:algorithm spatialSearch:s2 ;" + "spatialSearch:left ?y ;" + "spatialSearch:right ?b ;" + "spatialSearch:maxDistance 1 ; " + "spatialSearch:payload spatialSearch:all ." + " } }", + h::SpatialJoin(1, -1, V{"?y"}, V{"?b"}, std::nullopt, + PayloadVariables::all(), S2, scan("?x", "
", "?y"), + scan("?a", "
", "?b")));
+
+ // Nearest neighbors search requires the right child to be defined inside the
+ // service
AD_EXPECT_THROW_WITH_MESSAGE(
h::expect("PREFIX spatialSearch: "
"