Skip to content

Commit

Permalink
Added more rows to doctests and removed IOException:
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
  • Loading branch information
GumpacG committed Jul 26, 2023
1 parent c7b1402 commit 0613a09
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
12 changes: 7 additions & 5 deletions docs/user/general/datatypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,10 @@ A geopoint has a latitude and a longitude property. Although OpenSearch `support

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 |
|-----------------------------+------------------------+------------------------|
| {'lat': 40.71, 'lon': 74.0} | 40.71 | 74.0 |
+-----------------------------+------------------------+------------------------+
+----------------------------------+------------------------+------------------------+
| geo_point_object | geo_point_object.lat | geo_point_object.lon |
|----------------------------------+------------------------+------------------------|
| {'lat': 40.71, 'lon': 74.0} | 40.71 | 74.0 |
| {"lat": -33.852, "lon": 151.216} | -33.852 | 151.216 |
| null | null | null |
+----------------------------------+------------------------+------------------------+
4 changes: 3 additions & 1 deletion doctest/test_data/geopoint.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{"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]}}
{"geo_point_object": {"lat": 40.71, "lon": 74.00}}
{"geo_point_object": {"lat": -33.852, "lon": 151.216}}
{"geo_point_object": null}
15 changes: 7 additions & 8 deletions integ-test/src/test/java/org/opensearch/sql/sql/GeoPointIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.junit.Test;
import org.opensearch.sql.legacy.SQLIntegTestCase;

import java.io.IOException;
import java.util.Map;

import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_GEOPOINT;
Expand All @@ -23,7 +22,7 @@ protected void init() throws Exception {
}

@Test
public void test_geo_point() throws IOException {
public void test_geo_point() {
String query = "SELECT geo_point_object FROM " + TEST_INDEX_GEOPOINT;
JSONObject result = executeJdbcRequest(query);
verifyDataRows(result,
Expand All @@ -38,7 +37,7 @@ public void test_geo_point() throws IOException {
}

@Test
public void test_geo_point_unsupported_format() throws IOException {
public void test_geo_point_unsupported_format() {
String query = "SELECT geo_point_geohash FROM " + TEST_INDEX_GEOPOINT;
Exception exception = assertThrows(RuntimeException.class,
() -> executeJdbcRequest(query));
Expand All @@ -53,7 +52,7 @@ public void test_geo_point_unsupported_format() throws IOException {
}

@Test
public void test_geo_point_in_objects() throws IOException {
public void test_geo_point_in_objects() {
String query = "SELECT object.geo_point_object FROM " + TEST_INDEX_GEOPOINT;
JSONObject result = executeJdbcRequest(query);
verifyDataRows(result,
Expand All @@ -69,7 +68,7 @@ public void test_geo_point_in_objects() throws IOException {
}

@Test
public void test_geo_point_lat_in_objects() throws IOException {
public void test_geo_point_lat_in_objects() {
String query = "SELECT object.geo_point_object.lat FROM " + TEST_INDEX_GEOPOINT;
JSONObject result = executeJdbcRequest(query);
verifyDataRows(result,
Expand All @@ -80,7 +79,7 @@ public void test_geo_point_lat_in_objects() throws IOException {
}

@Test
public void test_geo_point_lat_and_lon() throws IOException {
public void test_geo_point_lat_and_lon() {
String query = "SELECT geo_point_object.lat, geo_point_object.lon FROM " + TEST_INDEX_GEOPOINT;
JSONObject result = executeJdbcRequest(query);
verifyDataRows(result,
Expand All @@ -91,7 +90,7 @@ public void test_geo_point_lat_and_lon() throws IOException {
}

@Test
public void test_geo_point_object_with_lat_and_lon() throws IOException {
public void test_geo_point_object_with_lat_and_lon() {
String query = "SELECT geo_point_object, geo_point_object.lat," +
" geo_point_object.lon FROM " + TEST_INDEX_GEOPOINT;
JSONObject result = executeJdbcRequest(query);
Expand All @@ -109,7 +108,7 @@ public void test_geo_point_object_with_lat_and_lon() throws IOException {
}

@Test
public void test_geo_point_lat_in_functions() throws IOException {
public void test_geo_point_lat_in_functions() {
String query = "SELECT ABS(geo_point_object.lat) FROM " + TEST_INDEX_GEOPOINT;
JSONObject result = executeJdbcRequest(query);
verifyDataRows(result,
Expand Down

0 comments on commit 0613a09

Please sign in to comment.