-
Notifications
You must be signed in to change notification settings - Fork 590
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
FEAT: Add new geospatial functions to OmniSciDB backend #1836
FEAT: Add new geospatial functions to OmniSciDB backend #1836
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1836 +/- ##
==========================================
- Coverage 87.46% 85.69% -1.78%
==========================================
Files 81 81
Lines 15458 15501 +43
Branches 1977 1985 +8
==========================================
- Hits 13520 13283 -237
- Misses 1571 1853 +282
+ Partials 367 365 -2
|
b8e88b3
to
a6704ec
Compare
|
@cpcloud it seems it is done for a review .. there is just one error related to impala |
ibis/mapd/operations.py
Outdated
| dtype_from = arg._dtype.geotype | ||
| dtype_target = target.geotype | ||
|
|
||
| if dtype_from == dtype_target: |
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.
Why is this an error and not a no-op?
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.
I think I am not following you here. could you provide more details?
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.
I think I'm not understanding why it's an error to cast from a geotype to the same geotype. That is what you're doing here is it not?
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.
Oh I see .. you're right. I will fix that! thanks!
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 @cpcloud for the feedback.
I will apply the changes you requested.
I added some comments and question for some topics here. thanks!
ibis/mapd/operations.py
Outdated
| dtype_from = arg._dtype.geotype | ||
| dtype_target = target.geotype | ||
|
|
||
| if dtype_from == dtype_target: |
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.
I think I am not following you here. could you provide more details?
a6704ec
to
7ebcecf
Compare
|
@xmnlab Looks like conda-forge is not working at the moment, lots of 503s. |
|
@cpcloud it seems yesterday conda-forge was also unstable ... |
|
@cpcloud I fix the code related to cast with same type (#1836 (comment)) let me know your thoughts about the approach used. |
ibis/expr/api.py
Outdated
| target_type.lower() in ('geometry', 'geography') | ||
| and ( | ||
| arg.type().geotype == target_type | ||
| or (arg.type().geotype is None and target_type == 'geometry') |
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.
Can you explain the behavior here? I'm not sure I follow purpose of this additional logic. In particular, what is the rationale for not performing a cast in these conditions?
It looks like you're trying to enable generic "cast to geometry or geography" functionality, and trying to avoid generating code for cast that would essentially be a no-op. Is there any reason to avoid generating this code?
I want to make sure we're not baking in assumptions that are tied to the OmniSci backend in the generic expression API, so if you could walk me through the reasoning here that would be helpful.
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.
It might help to add a unit test just for this functionality.
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.
well I will try to explain me.
In this PR the cast operation for geospatial works from point, linestring, polygon or multipolygon to geometry or geography.
point, linestring, polygon and multipolygon have a attribute called geotype that specify it is a geometry or geography (also it could be None, that is treated as geometry)
so cast from geometry to geometry is the same to cast int to int ... so I am follow the same idea of if op.to.equals(arg.type()): ...
currently omniscidb doesn't support cast to geometry ... but I am treating that just inside the mapd backend.
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.
Ok, makes a bit more sense now. Can you perform the comparison with op.to instead of looking at target_type? op.to is an instance of DataType as opposed to target_type which can be either a string or a DataType.
ibis/expr/api.py
Outdated
| target_type.lower() in ('geometry', 'geography') | ||
| and ( | ||
| arg.type().geotype == target_type | ||
| or (arg.type().geotype is None and target_type == 'geometry') |
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.
Ok, makes a bit more sense now. Can you perform the comparison with op.to instead of looking at target_type? op.to is an instance of DataType as opposed to target_type which can be either a string or a DataType.
|
@cpcloud Ok .. I will change that! thanks! |
|
there are more bug to fix .. I am working on that |
36c305b
to
d171051
Compare
|
@cpcloud it is done for a new review! py35_test failed because a |
ibis/expr/api.py
Outdated
| to_geotype = op.to.geotype | ||
| if ( | ||
| from_geotype == to_geotype | ||
| or (from_geotype is None and to_geotype == 'geometry') |
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.
I think this can be reduced to
from_geotype = arg.type().geotype or 'geometry'
to_geotype = op.to.geotype
if from_geotype == to_geotype:
...
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.
looks much better. thanks! I will change that
|
@xmnlab Can you rebase to pick up the fix for the failing tests? |
|
Once this is green, I'll merge. |
4fc33ed
to
9eaf660
Compare
|
rebased! thanks @cpcloud ! |
|
Thanks @xmnlab! |
Add 2 new geo spatial functions to OmniSciDB backend:
Add a cast to geographic type