Skip to content

Commit f2f4893

Browse files
authored
Stabilize analytics-engine multi-shard integration tests (#5803)
* test: stabilize analytics-engine multi-shard coverage Add deterministic ordering where the query contract permits it and narrowly gate confirmed analytics-engine capability gaps. Keep production query behavior unchanged. Signed-off-by: menwe <menwe@amazon.com> * test: gate GeoIP on analytics engine Signed-off-by: menwe <menwe@amazon.com> * test: select complete datetime fixture rows Signed-off-by: menwe <menwe@amazon.com> --------- Signed-off-by: menwe <menwe@amazon.com>
1 parent ecfa95c commit f2f4893

17 files changed

Lines changed: 115 additions & 17 deletions

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteAddColTotalsCommandIT.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ public void testAddColTotalsWithCustomLabel() throws IOException {
142142
var result =
143143
executeQuery(
144144
String.format(
145-
"source=%s | where age > 25 | head 2|fields age, balance | addcoltotals label='Sum'"
146-
+ " labelfield='Grand Total'",
145+
"source=%s | where age > 25 | sort account_number | head 2 | fields age, balance |"
146+
+ " addcoltotals label='Sum' labelfield='Grand Total'",
147147
TEST_INDEX_ACCOUNT));
148148

149149
verifySchema(
@@ -178,8 +178,8 @@ public void testAddColTotalsWithLabelAndLabelField() throws IOException {
178178
var result =
179179
executeQuery(
180180
String.format(
181-
"source=%s | where age > 25 |head 3| fields age, balance,firstname | addcoltotals "
182-
+ " age balance label='Sum' labelfield='firstname'",
181+
"source=%s | where age > 25 | sort account_number | head 3 | fields age, balance,"
182+
+ " firstname | addcoltotals age balance label='Sum' labelfield='firstname'",
183183
TEST_INDEX_ACCOUNT));
184184

185185
// Verify schema includes custom fieldname

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteAddTotalsCommandIT.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ public void testAddTotalsWithLabelAndLabelField() throws IOException {
303303
var result =
304304
executeQuery(
305305
String.format(
306-
"source=%s | where age > 25 |head 3| fields age, balance | addtotals row=false"
307-
+ " col=true label='Sum' labelfield='Total Summary'",
306+
"source=%s | where age > 25 | sort account_number | head 3 | fields age, balance |"
307+
+ " addtotals row=false col=true label='Sum' labelfield='Total Summary'",
308308
TEST_INDEX_ACCOUNT));
309309

310310
// Verify schema includes custom fieldname
@@ -327,8 +327,8 @@ public void testAddTotalsWithFieldnameAndSpecificFields() throws IOException {
327327
var result =
328328
executeQuery(
329329
String.format(
330-
"source=%s | where age > 25 |head 2| fields age, balance | addtotals balance"
331-
+ " fieldname='BalanceSum'",
330+
"source=%s | where age > 25 | sort account_number | head 2 | fields age, balance |"
331+
+ " addtotals balance fieldname='BalanceSum'",
332332
TEST_INDEX_ACCOUNT));
333333

334334
verifySchema(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteArrayFunctionIT.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
99
import static org.opensearch.sql.util.Capability.ARRAY_HIGHER_ORDER_FUNC;
10+
import static org.opensearch.sql.util.Capability.MULTISHARD_EXCHANGE_TYPE_MISMATCH;
1011
import static org.opensearch.sql.util.MatcherUtils.*;
1112

1213
import java.io.IOException;
@@ -808,6 +809,11 @@ public void testMvdedupWithAllDuplicates() throws IOException {
808809
}
809810

810811
@Test
812+
@RequiresCapability(
813+
value = MULTISHARD_EXCHANGE_TYPE_MISMATCH,
814+
note =
815+
"AE multi-shard: Field 'result' Substrait List(Utf8) vs table List(Null) -> Failed to"
816+
+ " create exchange sink (HTTP 500).")
811817
public void testMvdedupWithEmptyArray() throws IOException {
812818
JSONObject actual =
813819
executeQuery(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLAggregationIT.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_LOGS;
1414
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_TELEMETRY;
1515
import static org.opensearch.sql.util.Capability.CHECKED_ARITHMETIC_OVERFLOW;
16+
import static org.opensearch.sql.util.Capability.MULTISHARD_EXCHANGE_TYPE_MISMATCH;
1617
import static org.opensearch.sql.util.Capability.PERCENTILE_APPROXIMATE;
1718
import static org.opensearch.sql.util.Capability.STRICT_QUERY_REJECTION;
1819
import static org.opensearch.sql.util.MatcherUtils.assertJsonEquals;
@@ -1728,6 +1729,11 @@ public void testStatsMinOnStringField() throws IOException {
17281729
}
17291730

17301731
@Test
1732+
@RequiresCapability(
1733+
value = MULTISHARD_EXCHANGE_TYPE_MISMATCH,
1734+
note =
1735+
"AE multi-shard: group key t = unix_timestamp(birthdate) Substrait Float64 vs table Int64"
1736+
+ " -> Failed to create exchange sink (HTTP 500).")
17311737
public void testStatsCountOnFunctionsWithUDTArg() throws IOException {
17321738
JSONObject response =
17331739
executeQuery(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLBuiltinFunctionsNullIT.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DATE_FORMATS_WITH_NULL;
99
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_NULL_MISSING;
1010
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_STATE_COUNTRY_WITH_NULL;
11+
import static org.opensearch.sql.util.Capability.MULTISHARD_EXCHANGE_TYPE_MISMATCH;
1112
import static org.opensearch.sql.util.Capability.TIME_TYPE_WIDENED_TO_TIMESTAMP;
1213
import static org.opensearch.sql.util.MatcherUtils.*;
1314
import static org.opensearch.sql.util.MatcherUtils.rows;
@@ -164,6 +165,11 @@ public void testUnixTimestampInvalid() {
164165
}
165166

166167
@Test
168+
@RequiresCapability(
169+
value = MULTISHARD_EXCHANGE_TYPE_MISMATCH,
170+
note =
171+
"AE multi-shard: Field 'timestamp' Substrait Float64 vs table Int64 -> Failed to create"
172+
+ " exchange sink (HTTP 500).")
167173
public void testUnixTimestampNull() throws IOException {
168174
JSONObject actual =
169175
executeQuery(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLDashboardPatternsIT.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.opensearch.sql.calcite.remote;
77

88
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_HDFS_LOGS;
9+
import static org.opensearch.sql.util.Capability.PATTERNS_BRAIN_MODE;
910
import static org.opensearch.sql.util.MatcherUtils.rows;
1011
import static org.opensearch.sql.util.MatcherUtils.schema;
1112
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
@@ -15,6 +16,7 @@
1516
import org.json.JSONObject;
1617
import org.junit.Test;
1718
import org.opensearch.sql.ppl.PPLIntegTestCase;
19+
import org.opensearch.sql.util.RequiresCapability;
1820

1921
/** Pins the BRAIN-label pattern panel query shape used by OpenSearch Dashboards. */
2022
public class CalcitePPLDashboardPatternsIT extends PPLIntegTestCase {
@@ -26,6 +28,7 @@ public void init() throws Exception {
2628
}
2729

2830
@Test
31+
@RequiresCapability(PATTERNS_BRAIN_MODE)
2932
public void testDashboardBrainLabelStatsByPatternsField() throws IOException {
3033
JSONObject result =
3134
executeQuery(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLEvalMaxMinFunctionIT.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
99
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_NULL_MISSING;
10+
import static org.opensearch.sql.util.Capability.EVAL_MAX_MIN_ANY_TYPE;
1011
import static org.opensearch.sql.util.Capability.EVAL_MAX_MIN_INT_WIDENING;
1112
import static org.opensearch.sql.util.Capability.EVAL_MAX_MIN_MIXED_TYPES;
1213
import static org.opensearch.sql.util.MatcherUtils.rows;
@@ -59,6 +60,9 @@ public void testEvalMaxNumericWhenFieldSelected() throws Exception {
5960
}
6061

6162
@Test
63+
@RequiresCapability(
64+
value = EVAL_MAX_MIN_ANY_TYPE,
65+
note = "AE multi-shard: 'Unable to convert the type ANY' (HTTP 500) at the exchange.")
6266
public void testEvalMaxString() throws Exception {
6367
JSONObject result =
6468
executeQuery(
@@ -114,6 +118,9 @@ public void testEvalMinNumericWhenLiteralSelected() throws Exception {
114118
}
115119

116120
@Test
121+
@RequiresCapability(
122+
value = EVAL_MAX_MIN_ANY_TYPE,
123+
note = "AE multi-shard: 'Unable to convert the type ANY' (HTTP 500) at the exchange.")
117124
public void testEvalMinString() throws Exception {
118125
JSONObject result =
119126
executeQuery(
@@ -143,6 +150,9 @@ public void testEvalMinNumericAndString() throws Exception {
143150
}
144151

145152
@Test
153+
@RequiresCapability(
154+
value = EVAL_MAX_MIN_ANY_TYPE,
155+
note = "AE multi-shard: 'Unable to convert the type ANY' (HTTP 500) at the exchange.")
146156
public void testEvalMaxIgnoresNulls() throws Exception {
147157
JSONObject result =
148158
executeQuery(
@@ -164,6 +174,9 @@ public void testEvalMaxIgnoresNulls() throws Exception {
164174
}
165175

166176
@Test
177+
@RequiresCapability(
178+
value = EVAL_MAX_MIN_ANY_TYPE,
179+
note = "AE multi-shard: 'Unable to convert the type ANY' (HTTP 500) at the exchange.")
167180
public void testEvalMinIgnoresNulls() throws Exception {
168181
JSONObject result =
169182
executeQuery(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLInSubqueryIT.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public void testEmptyInSubquery() throws IOException {
223223
"source = %s | where id not in ["
224224
+ " source = %s | where uid = 0000 | fields uid"
225225
+ " ]"
226-
+ "| sort - salary"
226+
+ "| sort - salary, id"
227227
+ "| fields id, name, salary",
228228
TEST_INDEX_WORKER, TEST_INDEX_WORK_INFORMATION));
229229
verifySchema(result, schema("id", "int"), schema("name", "string"), schema("salary", "int"));
@@ -253,7 +253,7 @@ public void testNestedInSubquery() throws IOException {
253253
+ " ]"
254254
+ " | fields uid"
255255
+ " ]"
256-
+ "| sort - salary"
256+
+ "| sort - salary, id"
257257
+ "| fields id, name, salary",
258258
TEST_INDEX_WORKER, TEST_INDEX_WORK_INFORMATION, TEST_INDEX_OCCUPATION));
259259
verifySchema(result, schema("id", "int"), schema("name", "string"), schema("salary", "int"));
@@ -279,7 +279,7 @@ public void testNestedInSubquery2() throws IOException {
279279
+ " ]"
280280
+ " | fields uid"
281281
+ " ]"
282-
+ "| sort - salary | fields name, country, occupation, id, salary",
282+
+ "| sort - salary, id | fields name, country, occupation, id, salary",
283283
TEST_INDEX_WORKER, TEST_INDEX_WORK_INFORMATION, TEST_INDEX_OCCUPATION));
284284
verifySchema(
285285
result,

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLPatternsIT.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public void testSimplePatternAggregationMode_WithGroupBy_ShowNumberedToken() thr
236236
}
237237

238238
@Test
239+
@RequiresCapability(PATTERNS_BRAIN_MODE)
239240
public void testBrainLabelMode_NotShowNumberedToken() throws IOException {
240241
JSONObject result =
241242
executeQuery(
@@ -475,6 +476,7 @@ public void testBrainAggregationModeWithGroupByClause_ShowNumberedToken() throws
475476
}
476477

477478
@Test
479+
@RequiresCapability(PATTERNS_BRAIN_MODE)
478480
public void testBrainParseWithUUID_NotShowNumberedToken() throws IOException {
479481
JSONObject result =
480482
executeQuery(

‎integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteStreamstatsCommandIT.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ public void testStreamstatsBySpan() throws IOException {
296296
}
297297

298298
@Test
299+
@RequiresCapability(STREAMSTATS_SORT_NOT_HONORED)
299300
public void testStreamstatsBySpanWithNull() throws IOException {
300301
JSONObject actual =
301302
executeQuery(
@@ -352,6 +353,7 @@ public void testStreamstatsByMultiplePartitions2() throws IOException {
352353
}
353354

354355
@Test
356+
@RequiresCapability(STREAMSTATS_SORT_NOT_HONORED)
355357
public void testStreamstatsByMultiplePartitionsWithNull1() throws IOException {
356358
JSONObject actual =
357359
executeQuery(
@@ -1162,6 +1164,7 @@ public void testLeftJoinWithStreamstats() throws IOException {
11621164
}
11631165

11641166
@Test
1167+
@RequiresCapability(STREAMSTATS_SORT_NOT_HONORED)
11651168
public void testWhereInWithStreamstatsSubquery() throws IOException {
11661169
JSONObject actual =
11671170
executeQuery(

0 commit comments

Comments
 (0)