-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Switch JDBC driver to libs/geo objects for geo_shapes (#39204)
Switches JDBC driver to use libs/geo objects when server returns a geo_shape.
- Loading branch information
Showing
9 changed files
with
69 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
city,region,region_point,shape | ||
Mountain View,Americas,POINT(-105.2551 54.5260),point (-122.083843 37.386483) | ||
Chicago,Americas,POINT(-105.2551 54.5260),point (-87.637874 41.888783) | ||
New York,Americas,POINT(-105.2551 54.5260),point (-73.990027 40.745171) | ||
San Francisco,Americas,POINT(-105.2551 54.5260),point (-122.394228 37.789541) | ||
Phoenix,Americas,POINT(-105.2551 54.5260),point (-111.973505 33.376242) | ||
Amsterdam,Europe,POINT(15.2551 54.5260),point (4.850312 52.347557) | ||
Berlin,Europe,POINT(15.2551 54.5260),point (13.390889 52.486701) | ||
Munich,Europe,POINT(15.2551 54.5260),point (11.537505 48.146321) | ||
London,Europe,POINT(15.2551 54.5260),point (-0.121672 51.510871) | ||
Paris,Europe,POINT(15.2551 54.5260),point (2.351773 48.845538) | ||
Singapore,Asia,POINT(100.6197 34.0479),point (103.855535 1.295868) | ||
Hong Kong,Asia,POINT(100.6197 34.0479),point (114.183925 22.281397) | ||
Seoul,Asia,POINT(100.6197 34.0479),point (127.060851 37.509132) | ||
Tokyo,Asia,POINT(100.6197 34.0479),point (139.76402225 35.669616) | ||
Sydney,Asia,POINT(100.6197 34.0479),point (151.208629 -33.863385) |
18 changes: 18 additions & 0 deletions
18
x-pack/plugin/sql/qa/src/main/resources/geo/geosql.sql-spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Commands on geo test data | ||
// | ||
|
||
selectAllPointsAsStrings | ||
SELECT city, shape, region FROM "geo" ORDER BY "city"; | ||
|
||
selectAllPointsAsWKT | ||
SELECT city, ST_GEOMFROMTEXT(ST_ASWKT(shape)) shape_wkt, region FROM "geo" ORDER BY "city"; | ||
|
||
selectRegionUsingWktToSqlWithoutConvertion | ||
SELECT region, city, shape, ST_GEOMFROMTEXT(region_point) region_wkt FROM geo ORDER BY region, city; | ||
|
||
selectCitiesWithAGroupByWktToSql | ||
SELECT COUNT(city) city_by_region, ST_GEOMFROMTEXT(region_point) region_geom FROM geo WHERE city LIKE '%a%' GROUP BY region_geom ORDER BY city_by_region; | ||
|
||
selectCitiesWithEOrderByWktToSql | ||
SELECT region, city, UCASE(ST_ASWKT(ST_GEOMFROMTEXT(region_point))) region_wkt FROM geo WHERE city LIKE '%e%' ORDER BY region_wkt, city; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugin/sql/qa/src/main/resources/geo/setup_test_geo.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
DROP TABLE IF EXISTS "geo"; | ||
CREATE TABLE "geo" ( | ||
"city" VARCHAR(50), | ||
"region" VARCHAR(50), | ||
"region_point" VARCHAR(50), | ||
"shape" GEOMETRY | ||
) | ||
AS SELECT * FROM CSVREAD('classpath:/geo/geo.csv'); |