-
Notifications
You must be signed in to change notification settings - Fork 611
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
SUPP: Improve geospatial literals and smoke tests #1928
SUPP: Improve geospatial literals and smoke tests #1928
Conversation
@ian-r-rose it seems there are operations available for omniscidb that postgis doesn't have. |
@ian-r-rose it is done for review ... if you have time, some feedback would be awesome :) |
@cpcloud it is done for review :) 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.
Small change request, otherwise LGTM.
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.
@cpcloud I applied the suggestion you made. it is done for review.
Codecov Report
@@ Coverage Diff @@
## master #1928 +/- ##
==========================================
- Coverage 87.57% 85.94% -1.63%
==========================================
Files 93 93
Lines 16814 16837 +23
Branches 2138 2144 +6
==========================================
- Hits 14725 14471 -254
- Misses 1683 1959 +276
- Partials 406 407 +1
|
3a65449
to
f1ab6ba
Compare
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.
rebased!
@cpcloud looks like the CI tests passed! :) |
ibis/common/geospatial.py
Outdated
"""Convert a iterable with a linestring to text.""" | ||
return ', '.join(_format_point_value(point) for point in value) | ||
template = '({})' if nested else '{}' | ||
# fix wrong structure |
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 elaborate here? What exactly is wrong is about the structure if the first element is a tuple
or list
?
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.
for example this WKT POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
if anyone tries that in python (((30, 10), (40, 40), (20, 40), (10, 20), (30, 10)))
the outer parenthesis doesn't have any effect. the "correct" way to write that would be (((30, 10), (40, 40), (20, 40), (10, 20), (30, 10)),)
(ensuring the tuple format on the outer parenthesis)
so this code is used to ensure the "correct" format of this data.
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 don't think we should try to mirror the syntax of postgres/postgis types here with a Python equivalent. A sequence of pairs of numbers is the contract.
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.
but it should be a tuple, another example shows that:
POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))
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 don't think we should be second guessing user input types. Can you write down the type of the input expected?
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.
anymore thoughts about that? should I change anything? or is it already OK?
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.
ah and if I should raise an error .. what would be the best Exception
to be used? IbisInputError
?
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.
Yeah, I think that makes sense.
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.
sounds good. I will change 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.
done! let me know your thoughts about the message and the type hint.
the current structure doesn't work with tests.all.conftest.pytest_pyfunc_call because I am not using an instance of trying to use 'Backend' it seems it is raising an error related to circular imports
the |
f1ab6ba
to
53eb12c
Compare
Ah, got it. Thanks for clarifying. |
53eb12c
to
33173b9
Compare
ibis/expr/tests/test_geospatial.py
Outdated
def test_geo_ops_smoke(backend, fn_expr): | ||
"""Smoke tests for geo spatial operations.""" | ||
geo_table = backend.table('geo') | ||
fn_expr(geo_table).compile() |
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.
Let's at least assert that the compiled result is not the empty string.
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.
sounds good!
@xmnlab Can you resolve the merge conflicts here? |
33173b9
to
7acb69f
Compare
@cpcloud, rebased! :) |
it is done for a new review. |
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.
LGTM. Thanks @xmnlab!
thanks @cpcloud! |
Improves geo spatial literals and smoke tests:
GeoMockConnection
to allow tests foromniscid
topostgresql
https://github.com/ibis-project/ibis/blob/master/ibis/expr/tests/mocks.py#L423postgis
backendResolves #1929
Resolves #1931
Resolves partially #1930