-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Remove geometry check for st_contain and st_within #8620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8620 +/- ##
=============================================
- Coverage 70.47% 29.36% -41.11%
=============================================
Files 1703 1692 -11
Lines 89569 89238 -331
Branches 13564 13532 -32
=============================================
- Hits 63123 26204 -36919
- Misses 21990 60602 +38612
+ Partials 4456 2432 -2024
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some comments
also, i think this handles first level func only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. added comments and also handled multiple level.
just was not sure multiple level is a common thing.
like
toGeometry(toSphericalGeography(toGeometry(%s)))
looks like unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it's possible for other nested functions such as some geometry manipulation.
|
plz take a look at the tests |
Jackie-Jiang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the correct fix. The filter operator relies on the H3 index on the column. If the column is within an expression, the result will be wrong. E.g. ST_DISTANCE(geoCol, 'point') is not the same as ST_DISTANCE(myFunc(geoCol), 'point'), and we cannot use the same index because the index is not applied to the myFunc(geoCol)
is it ok for me to add constraints that the function only can be |
Why do you need to do |
I think the underlying is a point. H3 index only take coordinate. so it can be applied to both geography and geometry. Also ST_Contains only can be applied to |
|
@yupeng9 Can we apply |
|
current implementation of |
@yupeng9 Understood, but why does it not apply to the geography objects? |
Different implementation, and I didn't scope it in the inital impl |
@yupeng9 Is H3 index always based on the geography objects? If so, we cannot use H3 index for ST_Contains because that will give wrong result (mixing geometry calculation with geography calculation). |
Yes, H3 is always based on geography. And yes, we can do approximation for small area. |
|
Then my suggestion is to remove the geometry check in the |
thanks Jackie and Yupeng. just curious why it is not accurate? My use case is checking all the coordinates inside a city polygon (like SF). is it small area or big area for a city like SF? |
* Adding DML definition and parse sql * Use MinionClient for execute async task * Add integration tests
IMO a single city on the earth sphere can be considered small area. |
|
@Jackie-Jiang is spot on. There are corner cases around the boundary, and thats the risk you have face with the approximation. Alternatively, you can explore the ST_Contains implementation for geography and add the proper impl to Pinot |
|
I think we can merge this and update our documentation to warn about the behavior so that H3 index can be used for now. The geography support can be added in a separate PR. @yupeng9 wdyt? |
|
I'm fine with it. @WangCHX Please highlight this and put a warning in the user doc |
sure. will add that. |
Instructions:
enhancement