Skip to content

Commit

Permalink
Fixed doctest failure
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <[email protected]>
  • Loading branch information
GumpacG committed Jul 24, 2023
1 parent 43da319 commit 67d05d0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/user/general/datatypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ Geopoint Data Types

A geopoint has a latitude and a longitude property. Although OpenSearch `supports multiple formats <https://opensearch.org/docs/2.3/opensearch/supported-field-types/geo-point/>`_, the SQL plugin currently only supports the format :code:`{"lat": number, "lon": number}`. The geopoint object can be queried or lat and lon can be specified using dot notation. For example, ::

os> SELECT geo_point_object, geo_point_object.lat, geo_point_object.lon FROM geo_point;
os> SELECT geo_point_object, geo_point_object.lat, geo_point_object.lon FROM geopoint;
fetched rows / total rows = 1/1
+-----------------------------+------------------------+------------------------+
| geo_point_object | geo_point_object.lat | geo_point_object.lon |
Expand Down
6 changes: 6 additions & 0 deletions doctest/test_data/geopoint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"index":{"_id":"1"}}
{"geo_point_object": {"lat": 40.71, "lon": 74.00}, "object": {"geo_point_object": {"lat": 40.71, "lon": 74.00}}, "geo_point_string": "40.71, 74.00", "geo_point_geohash": "txhxegj0uyp3", "geo_point_array": [74.00, 40.71], "geo_point_string_point": "POINT (74.00 40.71)", "geo_point_geojson": {"type": "Point", "coordinates": [74.00, 40.71]}}
{"index":{"_id":"2"}}
{"geo_point_object": {"lat": -33.85253637358241, "lon": 151.21652352950258}, "object": {"geo_point_object": {"lat": -33.85253637358241, "lon": 151.21652352950258}},"geo_point_string": "-33.85356510743158, 151.22222172610114", "geo_point_geohash": "txhxegj0uyp3", "geo_point_array": [74.00, 40.71], "geo_point_string_point": "POINT (74.00 40.71)", "geo_point_geojson": {"type": "Point", "coordinates": [74.00, 40.71]}}
{"index":{"_id":"3"}}
{"geo_point_object": null, "object": {"geo_point_object": null},"geo_point_string": null, "geo_point_geohash": null, "geo_point_array": null, "geo_point_string_point": null, "geo_point_geojson": null}
2 changes: 2 additions & 0 deletions doctest/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
APACHE = "apache"
WILDCARD = "wildcard"
NESTED = "nested"
GEOPOINT = "geopoint"
DATASOURCES = ".ql-datasources"


Expand Down Expand Up @@ -97,6 +98,7 @@ def set_up_test_indices(test):
load_file("apache.json", index_name=APACHE)
load_file("wildcard.json", index_name=WILDCARD)
load_file("nested_objects.json", index_name=NESTED)
load_file("geopoint.json", index_name=GEOPOINT)
load_file("datasources.json", index_name=DATASOURCES)


Expand Down
32 changes: 32 additions & 0 deletions doctest/test_mapping/geopoint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"mappings": {
"properties": {
"geo_point_object": {
"type": "geo_point"
},
"object": {
"type": "object",
"properties": {
"geo_point_object": {
"type": "geo_point"
}
}
},
"geo_point_string": {
"type": "geo_point"
},
"geo_point_geohash": {
"type": "geo_point"
},
"geo_point_array": {
"type": "geo_point"
},
"geo_point_string_point": {
"type": "geo_point"
},
"geo_point_geojson": {
"type": "geo_point"
}
}
}
}

0 comments on commit 67d05d0

Please sign in to comment.