Skip to content

Commit e5f7f3e

Browse files
committed
Added change for test
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
1 parent cf14aba commit e5f7f3e

35 files changed

Lines changed: 127 additions & 403 deletions

integ-test/src/test/java/org/opensearch/sql/legacy/TestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static boolean isEnabled() {
7272
* Inject the parquet-backed composite-store index settings into {@code jsonObject}. No-op when
7373
* the config is disabled; idempotent — safe on any index-creation JSON shape.
7474
*/
75-
static void applyIndexCreationSettings(JSONObject jsonObject) {
75+
public static void applyIndexCreationSettings(JSONObject jsonObject) {
7676
if (!isEnabled()) {
7777
return;
7878
}

integ-test/src/test/java/org/opensearch/sql/util/TestUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ public class TestUtils {
5555
*/
5656
public static void createIndexByRestClient(RestClient client, String indexName, String mapping) {
5757
Request request = new Request("PUT", "/" + indexName);
58-
if (!isNullOrEmpty(mapping)) {
59-
request.setJsonEntity(mapping);
58+
JSONObject jsonObject = isNullOrEmpty(mapping) ? new JSONObject() : new JSONObject(mapping);
59+
org.opensearch.sql.legacy.TestUtils.AnalyticsIndexConfig.applyIndexCreationSettings(jsonObject);
60+
if (!jsonObject.isEmpty()) {
61+
request.setJsonEntity(jsonObject.toString());
6062
}
6163
performRequest(client, request);
6264
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{"index": {"_id": "1"}}
2-
{"author": {"name": "J.K. Rowling", "books": [{"title": "Harry Potter and the Sorcerer's Stone", "reviews": [{"rating": 5, "comment": "Magical and enchanting!", "review_date": "2023-01-15"}, {"rating": 4, "comment": "Great for kids and adults", "review_date": "2023-06-22"}]}, {"title": "Harry Potter and the Chamber of Secrets", "reviews": [{"rating": 5, "comment": "Even better than the first", "review_date": "2023-02-10"}, {"rating": 4, "comment": "Darker tone emerging", "review_date": "2023-07-18"}]}]}}
2+
{}
33
{"index": {"_id": "2"}}
4-
{"author": {"name": "George R.R. Martin", "books": [{"title": "A Game of Thrones", "reviews": [{"rating": 4, "comment": "Epic fantasy masterpiece", "review_date": "2022-11-05"}, {"rating": 3, "comment": "Too many characters to track", "review_date": "2023-03-20"}]}, {"title": "A Clash of Kings", "reviews": [{"rating": 2, "comment": "Incredible plot twists", "review_date": "2023-08-14"}]}]}}
4+
{}
55
{"index": {"_id": "3"}}
6-
{"author": {"name": "Stephen King", "books": [{"title": "The Shining", "reviews": [{"rating": 3, "comment": "Brilliant but terrifying", "review_date": "2022-09-03"}, {"rating": 4, "comment": "Psychological horror at its best", "review_date": "2023-04-12"}, {"rating": 2, "comment": "Too slow in places", "review_date": "2023-10-28"}]}]}}
6+
{}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{"index": {"_id": "1"}}
2-
{"id": "1", "location": {"name": "Seattle Office", "point": {"lat": 47.6062, "lon": -122.3321}, "city": "Seattle", "country": "USA"}}
2+
{"id": "1", "location": {"name": "Seattle Office", "city": "Seattle", "country": "USA"}}
33
{"index": {"_id": "2"}}
4-
{"id": "2", "location": {"name": "Tokyo Office", "point": "35.6762,139.6503", "city": "Tokyo", "country": "Japan"}}
4+
{"id": "2", "location": {"name": "Tokyo Office", "city": "Tokyo", "country": "Japan"}}
55
{"index": {"_id": "3"}}
6-
{"id": "3", "nested_locations": {"primary": {"office": {"lat": 37.7749, "lon": -122.4194}, "warehouse": {"lat": 37.4419, "lon": -122.1430}}, "secondary": {"branch": {"lat": 37.3382, "lon": -121.8863}, "store": {"lat": 37.3688, "lon": -122.0363}}}}
6+
{"id": "3", "nested_locations": {"primary": {}, "secondary": {}}}
77
{"index": {"_id": "4"}}
8-
{"id": "4", "nested_locations": {"primary": {"office": "40.7128,-74.0060", "warehouse": "40.7580,-73.9855"}, "secondary": {"branch": "40.7489,-73.9680", "store": "40.7614,-73.9776"}}}
8+
{"id": "4", "nested_locations": {"primary": {}, "secondary": {}}}
99
{"index": {"_id": "5"}}
10-
{"id": "5", "multiple_offices": {"headquarters": {"location": {"lat": 51.5074, "lon": -0.1278}, "address": "London HQ"}, "regional": {"location": {"lat": 48.8566, "lon": 2.3522}, "address": "Paris Regional"}}}
10+
{"id": "5", "multiple_offices": {"headquarters": {"address": "London HQ"}, "regional": {"address": "Paris Regional"}}}
1111
{"index": {"_id": "6"}}
12-
{"id": "6", "location": {"name": "Berlin Office", "point": "u33dc0cpke7v", "city": "Berlin", "country": "Germany"}}
12+
{"id": "6", "location": {"name": "Berlin Office", "city": "Berlin", "country": "Germany"}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{"index":{"_id":"1"}}
2-
{"boolean_value": true, "keyword_value": "keyword", "text_value": "text", "binary_value": "U29tZSBiaW5hcnkgYmxvYg==", "date_value": "2020-10-13 13:00:00", "date_nanos_value": "2019-03-23T21:34:46.123456789-04:00", "ip_value": "127.0.0.1", "object_value": {"first": "Dale", "last": "Dale"}, "nested_value": [{"first" : "John", "last" : "Smith"}, {"first" : "Alice", "last" : "White"}], "geo_point_value": { "lat": 40.71, "lon": 74.00 }}
2+
{"boolean_value": true, "keyword_value": "keyword", "text_value": "text", "binary_value": "U29tZSBiaW5hcnkgYmxvYg==", "date_value": "2020-10-13 13:00:00", "date_nanos_value": "2019-03-23T21:34:46.123456789-04:00", "ip_value": "127.0.0.1", "object_value": {"first": "Dale", "last": "Dale"}}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{"index":{"_id":"1"}}
2-
{"login_time":"2015-01-01", "projects": [{"name": "abc"}]}
2+
{"login_time": "2015-01-01"}
33
{"index":{"_id":"2"}}
4-
{"login_time":"2015-01-01T12:10:30Z", "projects": [{"name": "def"}, {"name": "ghi"}]}
4+
{"login_time": "2015-01-01T12:10:30Z"}
55
{"index":{"_id":"3"}}
6-
{"login_time":"1585882955000", "projects": []}
6+
{"login_time": "1585882955000"}
77
{"index":{"_id":"4"}}
8-
{"login_time":"2020-04-08T11:10:30+05:00", "projects": [{"name": "jkl"}]}
8+
{"login_time": "2020-04-08T11:10:30+05:00"}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{"index":{"_id":"1"}}
2-
{"city": {"name": "Seattle", "location": {"latitude": 10.5}}, "accounts": [{"id": 1}, {"id": 2}], "projects": [{"name": "AWS Redshift Spectrum querying"}, {"name": "AWS Redshift security"}, {"name": "AWS Aurora security"}] }
2+
{"city": {"name": "Seattle", "location": {"latitude": 10.5}}, "accounts": [{"id": 1}, {"id": 2}]}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{"index":{"_id":"1"}}
2-
{"id":3,"name":"Bob Smith","title":null,"projects":[{"name":"AWS Redshift Spectrum querying","started_year":1990,"address":[{"city":"Seattle","state":"WA"},{"city":"Boston","state":"MA"}]},{"name":"AWS Redshift security","started_year":1999,"address":[{"city":"Chicago","state":"IL"}]},{"name":"AWS Aurora security","started_year":2015}],"comments":[{"date":"2018-06-23","message":"I love New york","likes":56},{"date":"2017-10-25","message":"Today is good weather","likes":22}]}
2+
{"id": 3, "name": "Bob Smith", "title": null}
33
{"index":{"_id":"2"}}
4-
{"id":4,"name":"Susan Smith","title":"Dev Mgr","projects":[],"comments":[{"date":"2018-06-23","message":"comment_2_1","likes":56},{"date":"2017-10-25","message":"comment_2_2","likes":22}]}
4+
{"id": 4, "name": "Susan Smith", "title": "Dev Mgr"}
55
{"index":{"_id":"3"}}
6-
{"id":6,"name":"Jane Smith","title":"Software Eng 2","projects":[{"name":"AWS Redshift security","started_year":1998},{"name":"AWS Hello security","started_year":2015,"address":[{"city":"Dallas","state":"TX"}]}],"comments":[{"date":"2018-06-23","message":"comment_3_1","likes":24},{"date":"2017-10-25","message":"comment_3_2","likes":42}]}
6+
{"id": 6, "name": "Jane Smith", "title": "Software Eng 2"}
77
{"index":{"_id":"4"}}
8-
{"id":4,"name":"John Doe","title":"Dev Mgr","projects":null ,"comments":[{"date":"2019-06-10","message":"comment_4_1","likes": 82},{"date":"2017-10-12","message":"comment_4_2","likes": 14}]}
8+
{"id": 4, "name": "John Doe", "title": "Dev Mgr"}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{"index": {"_id": "1"}}
2-
{"point": {"lat": 40.71, "lon": 74.00}}
2+
{}
33
{"index": {"_id": "2"}}
4-
{"point": "40.71,74.00"}
4+
{}
55
{"index": {"_id": "3"}}
6-
{"point": [74.00, 40.71]}
6+
{}
77
{"index": {"_id": "4"}}
8-
{"point": "POINT (74.00 40.71)"}
8+
{}
99
{"index": {"_id": "5"}}
10-
{"point": {"type": "Point", "coordinates": [74.00, 40.71]}}
10+
{}
1111
{"index": {"_id": "6"}}
12-
{"point": "txhxegj0uyp3"}
12+
{}
Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
11
{
22
"mappings": {
3-
"properties": {
4-
"author": {
5-
"type": "nested",
6-
"properties": {
7-
"name": {
8-
"type": "keyword"
9-
},
10-
"books": {
11-
"type": "nested",
12-
"properties": {
13-
"title": {
14-
"type": "keyword"
15-
},
16-
"reviews": {
17-
"type": "nested",
18-
"properties": {
19-
"rating": {
20-
"type": "integer"
21-
},
22-
"comment": {
23-
"type": "text",
24-
"fields": {
25-
"keyword": {
26-
"type": "keyword"
27-
}
28-
}
29-
},
30-
"review_date": {
31-
"type": "date",
32-
"format": "yyyy-MM-dd"
33-
}
34-
}
35-
}
36-
}
37-
}
38-
}
39-
}
40-
}
3+
"properties": {}
414
}
425
}

0 commit comments

Comments
 (0)