Geospatial type implementations don't handle 'EMPTY' values.

Description

Well-Known Text apparently supports 'EMPTY' values, i.e. POLYGON EMPTY. This BNF notation shows that all types support 'EMPTY' and the OGC library seems to support it.

If I try the following for example in cqlsh:

I get back 'POLYGON()' instead of 'POLYGON EMPTY', which is not valid.

In addition, constructors don't handle 0 parameters, so you can't construct empty shapes either.

It seems that DSE supports empty Polygons and LineStrings, but not Points or Circle, opened DSP-8369 for that.

Environment

None

Pull Requests

None

Activity

Show:
Adam Holmberg
February 13, 2016, 4:30 AM

Tentative changes: https://github.com/datastax/python-driver-dse/pull/7

I'm parking this until we come to some resolution on the server ticket.

Adam Holmberg
March 4, 2016, 6:46 AM

Also going to remove CircleType: https://datastax.jira.com/browse/DSP-8653

Greg Bestland
March 16, 2016, 10:11 AM
Edited

Couple of notes.

Point still doesn't work with the EMPTY keyword. This is a serverside problem. I'm not sure if that's expected to change or not.

Ran into a little snag here with Polygon types,

I added some tests here
https://github.com/datastax/python-driver-dse/blob/481-test/tests/integration/test_geometry.py#L190-L217

When I ran them agains the POLYGON type, I saw this des error pop up.
Test Case:

Error

This appears to be from ring deserialization portion of the code.

The fix was pretty straight forward. I simply added a check for the deserialized ring size. It's here.
https://github.com/datastax/python-driver-dse/blob/481-test/dse/cqltypes.py#L96-L99

Let me know what you think, about the fix, and about point types not being supported.

Adam Holmberg
March 17, 2016, 3:34 AM
Edited

Fix looks good. Thanks for identifying and resolving that.

Point types are not supported (see this comment in DSP-8369).

PR is merged.

Greg Bestland
March 17, 2016, 4:11 AM

Thanks for the code review, Moving to done.

Fixed

Assignee

Unassigned

Reporter

Andy Tolbert

Fix versions

Labels

Reproduced in

None

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Components

Sprint

Py P-NEXT

Priority

Minor