You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "zhangfengcdt (via GitHub)" <gi...@apache.org> on 2025/09/12 14:24:30 UTC

[PR] docs: Add barrier function documentation and use it in KNN join example [sedona-db]

zhangfengcdt opened a new pull request, #72:
URL: https://github.com/apache/sedona-db/pull/72

   (no comment)


-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs: Add barrier function documentation and use it in KNN join example [sedona-db]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #72:
URL: https://github.com/apache/sedona-db/pull/72


-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs: Add barrier function documentation and use it in KNN join example [sedona-db]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs: Add barrier function documentation and use it in KNN join example [sedona-db]

Posted by "zhangfengcdt (via GitHub)" <gi...@apache.org>.
zhangfengcdt commented on PR #72:
URL: https://github.com/apache/sedona-db/pull/72#issuecomment-3285819939

   > LGTM overall. Can you elaborate a bit more in the doc about why applying the filter before and after the KNN actually have different semantic meanings?
   
   Sure, explanations have been added with examples to the doc.


-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs: Add barrier function documentation and use it in KNN join example [sedona-db]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #72:
URL: https://github.com/apache/sedona-db/pull/72#issuecomment-3285713346

   LGTM overall. Can you elaborate a bit more in the doc about why applying the filter before and after the KNN actually have different meanings?


-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org