Skip to content

Commit ef81a5f

Browse files
committed
Migrate array, aggregation, appendcol, and datetime ITs to remote
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 9a57af9 commit ef81a5f

9 files changed

Lines changed: 436 additions & 439 deletions

integ-test/src/test/java/org/opensearch/sql/calcite/standalone/CalciteArrayFunctionIT.java renamed to integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteArrayFunctionIT.java

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/*
2-
* Copyright OpenSearch Contributors
3-
* SPDX-License-Identifier: Apache-2.0
2+
*
3+
* * Copyright OpenSearch Contributors
4+
* * SPDX-License-Identifier: Apache-2.0
5+
*
46
*/
57

6-
package org.opensearch.sql.calcite.standalone;
8+
package org.opensearch.sql.calcite.remote;
79

810
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
911
import static org.opensearch.sql.util.MatcherUtils.*;
@@ -12,16 +14,20 @@
1214
import java.util.List;
1315
import org.json.JSONObject;
1416
import org.junit.jupiter.api.Test;
17+
import org.opensearch.client.ResponseException;
18+
import org.opensearch.sql.ppl.PPLIntegTestCase;
1519

16-
public class CalciteArrayFunctionIT extends CalcitePPLIntegTestCase {
20+
public class CalciteArrayFunctionIT extends PPLIntegTestCase {
1721
@Override
18-
public void init() throws IOException {
22+
public void init() throws Exception {
1923
super.init();
24+
enableCalcite();
25+
disallowCalciteFallback();
2026
loadIndex(Index.BANK);
2127
}
2228

2329
@Test
24-
public void testArray() {
30+
public void testArray() throws IOException {
2531
JSONObject actual =
2632
executeQuery(
2733
String.format(
@@ -34,7 +40,7 @@ public void testArray() {
3440
}
3541

3642
@Test
37-
public void testArrayWithString() {
43+
public void testArrayWithString() throws IOException {
3844
JSONObject actual =
3945
executeQuery(
4046
String.format(
@@ -48,23 +54,25 @@ public void testArrayWithString() {
4854

4955
@Test
5056
public void testArrayWithMix() {
51-
RuntimeException e =
57+
Class<? extends Exception> expectedException =
58+
isStandaloneTest() ? RuntimeException.class : ResponseException.class;
59+
Exception e =
5260
assertThrows(
53-
RuntimeException.class,
61+
expectedException,
5462
() ->
5563
executeQuery(
5664
String.format(
5765
"source=%s | eval array = array(1, true) | head 1 | fields array",
5866
TEST_INDEX_BANK)));
5967

60-
assertEquals(
61-
e.getMessage(),
68+
verifyErrorMessageContains(
69+
e,
6270
"Cannot resolve function: ARRAY, arguments: [INTEGER,BOOLEAN], caused by: fail to create"
6371
+ " array with fixed type: inferred array element type");
6472
}
6573

6674
@Test
67-
public void testArrayLength() {
75+
public void testArrayLength() throws IOException {
6876
JSONObject actual =
6977
executeQuery(
7078
String.format(
@@ -78,7 +86,7 @@ public void testArrayLength() {
7886
}
7987

8088
@Test
81-
public void testForAll() {
89+
public void testForAll() throws IOException {
8290
JSONObject actual =
8391
executeQuery(
8492
String.format(
@@ -92,7 +100,7 @@ public void testForAll() {
92100
}
93101

94102
@Test
95-
public void testExists() {
103+
public void testExists() throws IOException {
96104
JSONObject actual =
97105
executeQuery(
98106
String.format(
@@ -106,7 +114,7 @@ public void testExists() {
106114
}
107115

108116
@Test
109-
public void testFilter() {
117+
public void testFilter() throws IOException {
110118
JSONObject actual =
111119
executeQuery(
112120
String.format(
@@ -120,7 +128,7 @@ public void testFilter() {
120128
}
121129

122130
@Test
123-
public void testTransform() {
131+
public void testTransform() throws IOException {
124132
JSONObject actual =
125133
executeQuery(
126134
String.format(
@@ -134,7 +142,7 @@ public void testTransform() {
134142
}
135143

136144
@Test
137-
public void testTransformForTwoInput() {
145+
public void testTransformForTwoInput() throws IOException {
138146
JSONObject actual =
139147
executeQuery(
140148
String.format(
@@ -148,7 +156,7 @@ public void testTransformForTwoInput() {
148156
}
149157

150158
@Test
151-
public void testTransformForWithDouble() {
159+
public void testTransformForWithDouble() throws IOException {
152160
JSONObject actual =
153161
executeQuery(
154162
String.format(
@@ -162,7 +170,7 @@ public void testTransformForWithDouble() {
162170
}
163171

164172
@Test
165-
public void testTransformForWithUDF() {
173+
public void testTransformForWithUDF() throws IOException {
166174
JSONObject actual =
167175
executeQuery(
168176
String.format(
@@ -178,7 +186,7 @@ public void testTransformForWithUDF() {
178186
}
179187

180188
@Test
181-
public void testReduce() {
189+
public void testReduce() throws IOException {
182190
JSONObject actual =
183191
executeQuery(
184192
String.format(
@@ -195,7 +203,7 @@ public void testReduce() {
195203
}
196204

197205
@Test
198-
public void testReduce2() {
206+
public void testReduce2() throws IOException {
199207
JSONObject actual =
200208
executeQuery(
201209
String.format(
@@ -209,7 +217,7 @@ public void testReduce2() {
209217
}
210218

211219
@Test
212-
public void testReduce3() {
220+
public void testReduce3() throws IOException {
213221
JSONObject actual =
214222
executeQuery(
215223
String.format(
@@ -224,7 +232,7 @@ public void testReduce3() {
224232
}
225233

226234
@Test
227-
public void testReduceWithUDF() {
235+
public void testReduceWithUDF() throws IOException {
228236
JSONObject actual =
229237
executeQuery(
230238
String.format(

0 commit comments

Comments
 (0)