Skip to content
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

SQL: representation of geo objects in JDBC #35767

Closed
imotov opened this issue Nov 21, 2018 · 4 comments
Closed

SQL: representation of geo objects in JDBC #35767

imotov opened this issue Nov 21, 2018 · 4 comments
Assignees
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes :Analytics/SQL SQL querying

Comments

@imotov
Copy link
Contributor

imotov commented Nov 21, 2018

When a geo_shape or a geo_point is sent to the JDBC client, we need to represent it as some sort of the object when it is returned by JDBC's JdbcResultSet.getObject(int column) method. There are several possible alternatives here including

  • WKT String. Currently, geo points and geo shapes are serialized as WKT-formatted strings and we don't do any additional transformations on the JDBC side, so we are returning them as string. This is the simplest and the most straightforward solution, however, it provides minimal benefit for the users since they will have to load this string into some other object in order to do anything with it.

  • JTS Geometry. This is what H2 is currently using. One problem with this solution is that we will have to require or ship JTS library and we will not be able to release GEOSQL until H2GIS 1.5.0 is released. We are using H2GIS for testing it and it is still using JTS 1.14 at the moment, the rest of ES is using JTS 1.15. So, if we cannot ship JDBC with JTS 1.14, but we cannot test it with JTS 1.15.

  • Lucene's geo objects. Lucene now has its own set of Geometry objects that we could use. However, there are 2 missing pieces that prevent me from going ahead with this solution. 1) We will need to include these objects into our JDBC library and while the objects themselves are quite lean they have some dependencies on org.apache.lucene.geo.GeoUtils that pulls tons of other stuff. So, we would need to do some cleanup on the Lucene level to remove unnecessary dependencies. 2) we will need a way to deserialize the objects on the JDBC side and currently all reasonable parser (for WKT and GeoJSON) are integrated with ShapeBuilders that also have tons of dependencies including JTS. So, if we go with this solution, we need to start a massive refactoring of GeoShape to extract WKT or GeoJSON parser from it.

  • lib/geo minimum dependency Geometry class hierarchy. After additional discussions with @nknize another option came up with adding a minimal class hierarchy to lib/geo with just data classes and parsers (WKT and WKB). It might be possible to also reuse this hierarchy in other places, but that requires further investigation.

@imotov imotov added :Analytics/Geo Indexing, search aggregations of geo points and shapes :Analytics/SQL SQL querying team-discuss labels Nov 21, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo

@imotov
Copy link
Contributor Author

imotov commented Dec 11, 2018

After multiple discussions, we are going with the last option. The first PR #36477 should add the set of classes and in the follow up PR it will be replace the current String that is returned by JDBC driver when somebody asks for a geoshape.

imotov added a commit that referenced this issue Jan 15, 2019
Adds a set of geo classes to represent geo data in the JDBC driver and 
to be used as an intermediate format to pass geo shapes for indexing 
and query generation in #35320.

Relates to #35767 and #35320
@polyfractal
Copy link
Contributor

@imotov since #36477 merged into geosql, can/should this be closed? Or are we waiting until geosql merges into master?

imotov added a commit to imotov/elasticsearch that referenced this issue Feb 27, 2019
Switches JDBC driver to use libs/geo objects when server returns a
geo_point.

Closes elastic#35767
imotov added a commit that referenced this issue Mar 1, 2019
Switches JDBC driver to use libs/geo objects when server returns a
geo_point. It also removes separate functions for geo points and geo
shapes, which should simplify developing of geo functions.

Closes #35767
@imotov imotov closed this as completed Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes :Analytics/SQL SQL querying
Projects
None yet
Development

No branches or pull requests

3 participants