forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqlLegacyEngineSanityIT.java
More file actions
48 lines (41 loc) · 1.68 KB
/
Copy pathSqlLegacyEngineSanityIT.java
File metadata and controls
48 lines (41 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
package org.opensearch.sql.legacy;
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_PEOPLE;
import static org.opensearch.sql.util.MatcherUtils.rows;
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
import java.io.IOException;
import org.json.JSONObject;
import org.junit.Test;
/**
* Sanity tests for the legacy SQL engine. Many legacy integration tests (JoinIT, SubqueryIT,
* MultiQueryIT, etc.) are @Ignored because they assert on the deprecated JSON response format
* removed in 3.0. These tests provide minimal coverage that the legacy engine still executes
* correctly for queries that fall back from the V2 engine.
*/
public class SqlLegacyEngineSanityIT extends SQLIntegTestCase {
@Override
protected void init() throws Exception {
loadIndex(Index.DOG);
loadIndex(Index.PEOPLE);
}
@Test
public void testInnerJoinFallback() throws IOException {
JSONObject result =
executeQuery(
"SELECT a.firstname, d.dog_name FROM %s a JOIN %s d ON d.holdersName = a.firstname WHERE a.age > 35"
.formatted(TEST_INDEX_PEOPLE, TEST_INDEX_DOG));
verifyDataRows(result, rows("Hattie", "snoopy"));
}
@Test
public void testLeftJoinFallback() throws IOException {
JSONObject result =
executeQuery(
"SELECT a.firstname, d.dog_name FROM %s a LEFT JOIN %s d ON d.holdersName = a.firstname WHERE a.firstname = 'Daenerys'"
.formatted(TEST_INDEX_PEOPLE, TEST_INDEX_DOG));
verifyDataRows(result, rows("Daenerys", "rex"));
}
}