-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Add basic support for geo point (#31257)
Adds basic support for geo point type. For now, the geopoint is represented as a string and returned in the same format it was stored in the source. Relates to #29872
- Loading branch information
Showing
11 changed files
with
154 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,6 @@ | |
}, | ||
"salary" : { | ||
"type" : "integer" | ||
}, | ||
"site": { | ||
"type": "geo_shape" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
"properties" : { | ||
"location" : { | ||
"type" : "geo_point" | ||
}, | ||
"site": { | ||
"type" : "geo_shape" | ||
} | ||
} | ||
} |
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,33 @@ | ||
{"index":{"_id": "1"}} | ||
{"region": "Americas", "city": "Mountain View", "location": "37.386483,-122.083843"} | ||
{"index":{"_id": "2"}} | ||
{"region": "Americas", "city": "Chicago", "location": "41.888783,-87.637874"} | ||
{"index":{"_id": "3"}} | ||
{"region": "Americas", "city": "New York", "location": "40.745171,-73.990027"} | ||
{"index":{"_id": "4"}} | ||
{"region": "Americas", "city": "San Francisco", "location": "37.789541,-122.394228"} | ||
{"index":{"_id": "5"}} | ||
{"region": "Americas", "city": "Phoenix", "location": "33.376242,-111.973505"} | ||
{"index":{"_id": "6"}} | ||
{"region": "Europe", "city": "Amsterdam", "location": "52.347557,4.850312"} | ||
{"index":{"_id": "7"}} | ||
{"region": "Europe", "city": "Berlin", "location": "52.486701,13.390889"} | ||
{"index":{"_id": "8"}} | ||
{"region": "Europe", "city": "Munich", "location": "48.146321,11.537505"} | ||
{"index":{"_id": "9"}} | ||
{"region": "Europe", "city": "London", "location": "51.510871,-0.121672"} | ||
{"index":{"_id": "10"}} | ||
{"region": "Europe", "city": "Paris", "location": "48.845538,2.351773"} | ||
{"index":{"_id": "11"}} | ||
{"region": "Asia", "city": "Singapore", "location": "1.295868,103.855535"} | ||
{"index":{"_id": "12"}} | ||
{"region": "Asia", "city": "Hong Kong", "location": "22.281397,114.183925"} | ||
{"index":{"_id": "13"}} | ||
{"region": "Asia", "city": "Seoul", "location": "37.509132,127.060851"} | ||
{"index":{"_id": "14"}} | ||
{"region": "Asia", "city": "Tokyo", "location": "35.669616,139.76402225"} | ||
{"index":{"_id": "15"}} | ||
{"region": "Asia", "city": "Sydney", "location": "-33.863385,151.208629"} | ||
|
||
|
||
|
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,45 @@ | ||
// | ||
// Commands on geo test data | ||
// | ||
|
||
showTables | ||
SHOW TABLES 'geo'; | ||
|
||
name:s | type:s | ||
geo |BASE TABLE | ||
; | ||
|
||
// DESCRIBE | ||
|
||
describe | ||
DESCRIBE "geo"; | ||
|
||
column:s | type:s | ||
city | VARCHAR | ||
location | OTHER | ||
region | VARCHAR | ||
; | ||
|
||
// SELECT ALL | ||
// TODO: For now we just get geopoint formatted as is and we also need to convert it to STRING to work with CSV | ||
|
||
selectAllPoints | ||
SELECT city, CAST(location AS STRING) location, region FROM "geo" ORDER BY "city"; | ||
|
||
city:s | location:s | region:s | ||
Amsterdam |52.347557,4.850312 |Europe | ||
Berlin |52.486701,13.390889 |Europe | ||
Chicago |41.888783,-87.637874 |Americas | ||
Hong Kong |22.281397,114.183925 |Asia | ||
London |51.510871,-0.121672 |Europe | ||
Mountain View |37.386483,-122.083843 |Americas | ||
Munich |48.146321,11.537505 |Europe | ||
New York |40.745171,-73.990027 |Americas | ||
Paris |48.845538,2.351773 |Europe | ||
Phoenix |33.376242,-111.973505 |Americas | ||
San Francisco |37.789541,-122.394228 |Americas | ||
Seoul |37.509132,127.060851 |Asia | ||
Singapore |1.295868,103.855535 |Asia | ||
Sydney |-33.863385,151.208629 |Asia | ||
Tokyo |35.669616,139.76402225|Asia | ||
; |
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,20 @@ | ||
{ | ||
"settings": { | ||
"number_of_shards": 1 | ||
}, | ||
"mappings": { | ||
"doc": { | ||
"properties": { | ||
"region": { | ||
"type": "keyword" | ||
}, | ||
"city": { | ||
"type": "keyword" | ||
}, | ||
"location": { | ||
"type": "geo_point" | ||
} | ||
} | ||
} | ||
} | ||
} |