Copilot commented on code in PR #72:
URL: https://github.com/apache/sedona-db/pull/72#discussion_r2344432855


##########
docs/reference/sql-joins.md:
##########
@@ -52,3 +52,24 @@ FROM cities AS cities_l
 INNER JOIN cities AS cities_r
 ON ST_KNN(cities_l.geometry, cities_r.geometry, 5, false)
 ```
+
+## Optimization Barrier
+
+Use the `barrier` function to prevent filter pushdown and control predicate 
evaluation order in complex spatial joins. This function creates an 
optimization barrier by evaluating boolean expressions at runtime.
+
+### Example
+
+Find the 3 nearest high-rated restaurants to luxury hotels, ensuring the KNN 
join completes before filtering.
+
+```sql
+SELECT
+    h.name AS hotel,
+    r.name AS restaurant,
+    r.rating
+FROM hotels AS h
+INNER JOIN restaurants AS r
+ON ST_KNN(h.geometry, r.geometry, 3, false)
+WHERE barrier('rating > 4.0 AND stars >= 4',
+              'rating', r.rating,
+              'stars', h.stars)

Review Comment:
   The barrier function syntax and parameter explanation is unclear. Consider 
adding a brief explanation of the parameter structure: the first parameter is 
the boolean expression as a string, followed by variable name-value pairs that 
will be substituted into the expression.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to