Skip to content

Commit 5acf5a5

Browse files
MitchellGaleYury-FridlyandGumpacG
committed
[Spotless] Applying Google Code Format for integ-tests #10 (opensearch-project#1967)
* [Spotless] Applying Google Code Format for integ-tests #10 (#329) * Add spotless apply 33 files. Signed-off-by: Mitchell Gale <[email protected]> * Addressed PR comments. Signed-off-by: Mitchell Gale <[email protected]> * Address PR comments. Signed-off-by: Mitchell Gale <[email protected]> * fixing integ test failure. Signed-off-by: Mitchell Gale <[email protected]> --------- Signed-off-by: Mitchell Gale <[email protected]> * Update integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestConfigTest.java Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: Mitchell Gale <[email protected]> * Apply suggestions from code review Co-authored-by: Guian Gumpac <[email protected]> Signed-off-by: Mitchell Gale <[email protected]> * Apply suggestions from code review Co-authored-by: Guian Gumpac <[email protected]> Signed-off-by: Mitchell Gale <[email protected]> --------- Signed-off-by: Mitchell Gale <[email protected]> Signed-off-by: Mitchell Gale <[email protected]> Co-authored-by: Yury-Fridlyand <[email protected]> Co-authored-by: Guian Gumpac <[email protected]>
1 parent e030bfd commit 5acf5a5

File tree

7 files changed

+28
-47
lines changed

7 files changed

+28
-47
lines changed

integ-test/src/test/java/org/opensearch/sql/correctness/TestConfig.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import org.opensearch.sql.legacy.utils.StringUtils;
1919

2020
/**
21-
*
22-
*
2321
* <pre>
2422
* Test configuration parse the following information from command line arguments:
2523
* 1) Test schema and data

integ-test/src/test/java/org/opensearch/sql/correctness/testset/TestDataSet.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ private Object convertStringToObject(String type, String str) {
130130
@Override
131131
public String toString() {
132132
int total = dataRows.size();
133-
return String.format(
134-
"Test data set:\n Table name: %s\n Schema: %s\n Data rows (first 5 in %d):",
135-
tableName, schema, total)
133+
return String.format("Test data set:\n Table name: %s\n Schema: %s\n Data rows (first 5 in %d):", tableName, schema, total)
136134
+ dataRows.stream().limit(5).map(Arrays::toString).collect(joining("\n ", "\n ", "\n"));
137135
}
138136
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public void testNonExistingIndex() throws IOException {
5252
@Test
5353
public void testNonResolvingIndexPattern() throws IOException {
5454
try {
55-
explainQuery("SELECT * FROM opensearch_sql_test_blah_blah* WHERE firstname = 'Leo'");
55+
explainQuery(
56+
"SELECT * FROM opensearch_sql_test_blah_blah* WHERE firstname = 'Leo'");
5657
Assert.fail("Expected ResponseException, but none was thrown");
5758

5859
} catch (ResponseException e) {
@@ -264,7 +265,8 @@ public void testKeywordAliasGroupByUsingTableAlias() throws IOException {
264265
@Test
265266
public void testKeywordAliasOrderBy() throws IOException {
266267
String result =
267-
explainQuery("SELECT * FROM opensearch-sql_test_index_bank ORDER BY state, lastname ");
268+
explainQuery(
269+
"SELECT * FROM opensearch-sql_test_index_bank ORDER BY state, lastname ");
268270
assertThat(result, containsString("\"state.keyword\":{\"order\":\"asc\""));
269271
assertThat(result, containsString("\"lastname\":{\"order\":\"asc\"}"));
270272
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public static void createIndexByRestClient(RestClient client, String indexName,
5454

5555
/**
5656
* https://github.com/elastic/elasticsearch/pull/49959<br>
57-
* Deprecate creation of dot-prefixed index names except for hidden and system indices. Create
58-
* hidden index by REST client.
57+
* Deprecate creation of dot-prefixed index
58+
* names except for hidden and system indices. Create hidden index by REST client.
5959
*
6060
* @param client client connection
6161
* @param indexName test index name

integ-test/src/test/java/org/opensearch/sql/ppl/SystemFunctionIT.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ public void typeof_sql_types() throws IOException {
4545
"source=%s | eval "
4646
+ "`timestamp` = typeof(CAST('1961-04-12 09:07:00' AS TIMESTAMP)),"
4747
+ "`time` = typeof(CAST('09:07:00' AS TIME)),"
48-
+ "`date` = typeof(CAST('1961-04-12' AS DATE))"
49-
+ " | fields `timestamp`, `time`, `date`",
48+
+ "`date` = typeof(CAST('1961-04-12' AS DATE)),"
49+
+ "`datetime` = typeof(DATETIME('1961-04-12 09:07:00'))"
50+
+ " | fields `timestamp`, `time`, `date`, `datetime`",
5051
TEST_INDEX_DATATYPE_NUMERIC));
51-
verifyDataRows(response, rows("TIMESTAMP", "TIME", "DATE"));
52+
verifyDataRows(response, rows("TIMESTAMP", "TIME", "DATE", "DATETIME"));
5253
}
5354

5455
@Test
@@ -69,28 +70,19 @@ public void typeof_opensearch_types() throws IOException {
6970
response =
7071
executeQuery(
7172
String.format(
72-
"source=%s | eval `text` = typeof(text_value), `date` = typeof(date_value),"
73-
+ " `date_nanos` = typeof(date_nanos_value),`boolean` = typeof(boolean_value),"
74-
+ " `object` = typeof(object_value),`keyword` = typeof(keyword_value), `ip` ="
75-
+ " typeof(ip_value),`binary` = typeof(binary_value), `geo_point` ="
76-
+ " typeof(geo_point_value)"
73+
"source=%s | eval "
74+
+ "`text` = typeof(text_value), `date` = typeof(date_value),"
75+
+ "`boolean` = typeof(boolean_value), `object` = typeof(object_value),"
76+
+ "`keyword` = typeof(keyword_value), `ip` = typeof(ip_value),"
77+
+ "`binary` = typeof(binary_value), `geo_point` = typeof(geo_point_value)"
7778
// TODO activate this test once `ARRAY` type supported, see
7879
// ExpressionAnalyzer::isTypeNotSupported
7980
// + ", `nested` = typeof(nested_value)"
80-
+ " | fields `text`, `date`, `date_nanos`, `boolean`, `object`, `keyword`,"
81-
+ " `ip`, `binary`, `geo_point`",
81+
+ " | fields `text`, `date`, `boolean`, `object`, `keyword`, `ip`, `binary`,"
82+
+ " `geo_point`",
8283
TEST_INDEX_DATATYPE_NONNUMERIC));
8384
verifyDataRows(
8485
response,
85-
rows(
86-
"TEXT",
87-
"TIMESTAMP",
88-
"TIMESTAMP",
89-
"BOOLEAN",
90-
"OBJECT",
91-
"KEYWORD",
92-
"IP",
93-
"BINARY",
94-
"GEO_POINT"));
86+
rows("TEXT", "TIMESTAMP", "BOOLEAN", "OBJECT", "KEYWORD", "IP", "BINARY", "GEO_POINT"));
9587
}
9688
}

integ-test/src/test/java/org/opensearch/sql/sql/SystemFunctionIT.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ public void typeof_sql_types() {
3535
"SELECT"
3636
+ " typeof(CAST('1961-04-12 09:07:00' AS TIMESTAMP)),"
3737
+ " typeof(CAST('09:07:00' AS TIME)),"
38-
+ " typeof(CAST('1961-04-12' AS DATE))");
39-
verifyDataRows(response, rows("TIMESTAMP", "TIME", "DATE"));
38+
+ " typeof(CAST('1961-04-12' AS DATE)),"
39+
+ " typeof(DATETIME('1961-04-12 09:07:00'))");
40+
verifyDataRows(response, rows("TIMESTAMP", "TIME", "DATE", "DATETIME"));
4041
}
4142

4243
@Test
@@ -54,26 +55,16 @@ public void typeof_opensearch_types() {
5455
response =
5556
executeJdbcRequest(
5657
String.format(
57-
"SELECT typeof(text_value),typeof(date_value), typeof(date_nanos_value),"
58-
+ " typeof(boolean_value), typeof(object_value),"
59-
+ " typeof(keyword_value),typeof(ip_value), typeof(binary_value),"
60-
+ " typeof(geo_point_value)"
58+
"SELECT typeof(text_value),typeof(date_value), typeof(boolean_value),"
59+
+ " typeof(object_value), typeof(keyword_value),typeof(ip_value),"
60+
+ " typeof(binary_value), typeof(geo_point_value)"
6161
// TODO activate this test once `ARRAY` type supported, see
6262
// ExpressionAnalyzer::isTypeNotSupported
6363
// + ", typeof(nested_value)"
6464
+ " from %s;",
6565
TEST_INDEX_DATATYPE_NONNUMERIC));
6666
verifyDataRows(
6767
response,
68-
rows(
69-
"TEXT",
70-
"TIMESTAMP",
71-
"TIMESTAMP",
72-
"BOOLEAN",
73-
"OBJECT",
74-
"KEYWORD",
75-
"IP",
76-
"BINARY",
77-
"GEO_POINT"));
68+
rows("TEXT", "TIMESTAMP", "BOOLEAN", "OBJECT", "KEYWORD", "IP", "BINARY", "GEO_POINT"));
7869
}
7970
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public static void createIndexByRestClient(RestClient client, String indexName,
5757

5858
/**
5959
* https://github.com/elastic/elasticsearch/pull/49959<br>
60-
* Deprecate creation of dot-prefixed index names except for hidden and system indices. Create
61-
* hidden index by REST client.
60+
* Deprecate creation of dot-prefixed index
61+
* names except for hidden and system indices. Create hidden index by REST client.
6262
*
6363
* @param client client connection
6464
* @param indexName test index name

0 commit comments

Comments
 (0)