Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_NESTED_TYPE;
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_NESTED_WITH_QUOTES;
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_ONLINE;
import static org.opensearch.sql.util.Capability.RESPONSE_FORMAT;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -39,8 +40,10 @@
import org.opensearch.client.RequestOptions;
import org.opensearch.client.Response;
import org.opensearch.sql.legacy.executor.csv.CSVResult;
import org.opensearch.sql.util.RequiresCapability;

/** Tests to cover requests with "?format=csv" parameter */
@RequiresCapability(RESPONSE_FORMAT)
public class CsvFormatResponseIT extends SQLIntegTestCase {

private boolean flatOption = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DATE_TIME;
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_NESTED_SIMPLE;
import static org.opensearch.sql.legacy.plugin.RestSqlAction.QUERY_API_ENDPOINT;
import static org.opensearch.sql.util.Capability.PAGINATION_CURSOR;
import static org.opensearch.sql.util.TestUtils.verifyIsV2Cursor;

import java.io.IOException;
Expand All @@ -27,7 +28,9 @@
import org.opensearch.client.ResponseException;
import org.opensearch.sql.common.setting.Settings;
import org.opensearch.sql.legacy.utils.StringUtils;
import org.opensearch.sql.util.RequiresCapability;

@RequiresCapability(PAGINATION_CURSOR)
public class CursorIT extends SQLIntegTestCase {

private static final String CURSOR = "cursor";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.opensearch.sql.util.Capability.DATETIME_FORMAT_RENDERING;
import static org.opensearch.sql.util.Capability.PERCENTILE_APPROXIMATE;

import java.io.IOException;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.sql.util.RequiresCapability;

public class JdbcTestIT extends SQLIntegTestCase {

Expand All @@ -25,6 +28,7 @@ protected void init() throws Exception {
loadIndex(Index.WEBLOG);
}

@RequiresCapability(PERCENTILE_APPROXIMATE)
public void testPercentilesQuery() {
JSONObject response =
executeJdbcRequest(
Expand All @@ -43,6 +47,7 @@ public void testPercentilesQuery() {

// https://github.com/opensearch-project/sql/issues/537
@Test
@RequiresCapability(PERCENTILE_APPROXIMATE)
public void testSlowQuery() throws IOException {
// set slow log threshold = 0s
updateClusterSettings(new ClusterSetting(PERSISTENT, "plugins.sql.slowlog", "0"));
Expand Down Expand Up @@ -89,6 +94,7 @@ public void testDivisionInQuery() {
assertThat(response.getJSONArray("datarows").getJSONArray(0).getDouble(0), equalTo(16827.0));
}

@RequiresCapability(DATETIME_FORMAT_RENDERING)
public void testGroupByInQuery() {
JSONObject response =
executeJdbcRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
package org.opensearch.sql.legacy;

import static org.hamcrest.Matchers.equalTo;
import static org.opensearch.sql.util.Capability.EXPLAIN_FORMAT;
import static org.opensearch.sql.util.Capability.QUERY_ERROR_MESSAGE;

import java.io.IOException;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.opensearch.client.ResponseException;
import org.opensearch.sql.util.RequiresCapability;

/** Test cases for writing missing join table aliases. */
public class JoinAliasWriterRuleIT extends SQLIntegTestCase {
Expand All @@ -26,6 +29,7 @@ protected void init() throws Exception {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void noTableAliasNoCommonColumns() throws IOException {
sameExplain(
query(
Expand All @@ -45,6 +49,7 @@ public void noTableAliasNoCommonColumns() throws IOException {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void oneTableAliasNoCommonColumns() throws IOException {
sameExplain(
query(
Expand All @@ -61,6 +66,7 @@ public void oneTableAliasNoCommonColumns() throws IOException {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void bothTableAliasNoCommonColumns() throws IOException {
sameExplain(
query(
Expand All @@ -78,6 +84,7 @@ public void bothTableAliasNoCommonColumns() throws IOException {

@Test
@Ignore
@RequiresCapability(EXPLAIN_FORMAT)
public void tableNamesWithTypeName() throws IOException {
sameExplain(
query(
Expand All @@ -98,6 +105,7 @@ public void tableNamesWithTypeName() throws IOException {

@Ignore
@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void tableNamesWithTypeNameExplicitTableAlias() throws IOException {
sameExplain(
query(
Expand All @@ -114,6 +122,7 @@ public void tableNamesWithTypeNameExplicitTableAlias() throws IOException {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void actualTableNameAsAliasOnColumnFields() throws IOException {
sameExplain(
query(
Expand All @@ -130,6 +139,7 @@ public void actualTableNameAsAliasOnColumnFields() throws IOException {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void actualTableNameAsAliasOnColumnFieldsTwo() throws IOException {
sameExplain(
query(
Expand All @@ -150,6 +160,7 @@ public void actualTableNameAsAliasOnColumnFieldsTwo() throws IOException {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void columnsWithTableAliasNotAffected() throws IOException {
sameExplain(
query(
Expand All @@ -166,6 +177,7 @@ public void columnsWithTableAliasNotAffected() throws IOException {
}

@Test
@RequiresCapability(QUERY_ERROR_MESSAGE)
public void commonColumnWithoutTableAliasDifferentTables() throws IOException {
exception.expect(ResponseException.class);
exception.expectMessage("Field name [firstname] is ambiguous");
Expand All @@ -179,6 +191,7 @@ public void commonColumnWithoutTableAliasDifferentTables() throws IOException {
}

@Test
@RequiresCapability(QUERY_ERROR_MESSAGE)
public void sameTablesNoAliasAndNoAliasOnColumns() throws IOException {
exception.expect(ResponseException.class);
exception.expectMessage("Not unique table/alias: [opensearch-sql_test_index_bank]");
Expand All @@ -192,6 +205,7 @@ public void sameTablesNoAliasAndNoAliasOnColumns() throws IOException {
}

@Test
@RequiresCapability(QUERY_ERROR_MESSAGE)
public void sameTablesNoAliasWithTableNameAsAliasOnColumns() throws IOException {
exception.expect(ResponseException.class);
exception.expectMessage("Not unique table/alias: [opensearch-sql_test_index_bank]");
Expand All @@ -206,6 +220,7 @@ public void sameTablesNoAliasWithTableNameAsAliasOnColumns() throws IOException
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void sameTablesWithExplicitAliasOnFirst() throws IOException {
sameExplain(
query(
Expand All @@ -221,6 +236,7 @@ public void sameTablesWithExplicitAliasOnFirst() throws IOException {
}

@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void sameTablesWithExplicitAliasOnSecond() throws IOException {
sameExplain(
query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@

package org.opensearch.sql.legacy;

import static org.opensearch.sql.util.Capability.QUERY_ERROR_MESSAGE;

import java.io.IOException;
import java.util.Locale;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.json.JSONObject;
import org.junit.Assert;
import org.opensearch.client.ResponseException;
import org.opensearch.sql.util.RequiresCapability;

/** Tests for clean handling of various types of invalid queries */
@RequiresCapability(QUERY_ERROR_MESSAGE)
public class MalformedQueryIT extends SQLIntegTestCase {
@Override
protected void init() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsString;
import static org.opensearch.sql.util.Capability.EXPLAIN_FORMAT;
import static org.opensearch.sql.util.Capability.LEGACY_METHOD_QUERY;

import java.io.IOException;
import java.util.Locale;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.sql.util.RequiresCapability;

/**
* 定製方法查詢.
Expand Down Expand Up @@ -41,6 +44,7 @@ protected void init() throws Exception {
* @throws IOException
*/
@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void queryTest() throws IOException {
final String result =
explainQuery(
Expand Down Expand Up @@ -70,6 +74,7 @@ public void queryTest() throws IOException {
* @throws IOException
*/
@Test
@RequiresCapability(EXPLAIN_FORMAT)
public void matchQueryTest() throws IOException {
final String result =
explainQuery(
Expand Down Expand Up @@ -153,6 +158,7 @@ public void scoreQueryTest() throws IOException {
}

@Test
@RequiresCapability(LEGACY_METHOD_QUERY)
public void regexpQueryTest() throws IOException {
final String result =
explainQuery(
Expand All @@ -168,6 +174,7 @@ public void regexpQueryTest() throws IOException {
}

@Test
@RequiresCapability(LEGACY_METHOD_QUERY)
public void negativeRegexpQueryTest() throws IOException {
final String result =
explainQuery(
Expand Down Expand Up @@ -198,6 +205,7 @@ public void negativeRegexpQueryTest() throws IOException {
* @throws IOException
*/
@Test
@RequiresCapability(LEGACY_METHOD_QUERY)
public void wildcardQueryTest() throws IOException {
final String result =
explainQuery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.opensearch.sql.legacy;

import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DEEP_NESTED;
import static org.opensearch.sql.util.Capability.STRUCT_PARENT_FIELD;
import static org.opensearch.sql.util.MatcherUtils.rows;
import static org.opensearch.sql.util.MatcherUtils.schema;
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
Expand All @@ -16,11 +17,13 @@
import org.junit.Test;
import org.opensearch.sql.common.setting.Settings;
import org.opensearch.sql.legacy.utils.StringUtils;
import org.opensearch.sql.util.RequiresCapability;

/**
* Integration test for OpenSearch object field (and nested field). This class is focused on simple
* SELECT-FROM query to ensure right column number and value is returned.
*/
@RequiresCapability(STRUCT_PARENT_FIELD)
public class ObjectFieldSelectIT extends SQLIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.opensearch.sql.util.Capability.PAGINATION_CURSOR;

import java.io.IOException;
import org.json.JSONArray;
Expand All @@ -17,12 +18,14 @@
import org.opensearch.client.Response;
import org.opensearch.client.ResponseException;
import org.opensearch.sql.legacy.utils.StringUtils;
import org.opensearch.sql.util.RequiresCapability;

/**
* Integration test verifying PIT contexts are created only when needed and properly cleaned up.
*
* @see <a href="https://github.com/opensearch-project/sql/issues/5002">Issue #5002</a>
*/
@RequiresCapability(PAGINATION_CURSOR)
public class PointInTimeLeakIT extends SQLIntegTestCase {

private static final String TEST_INDEX = "test-logs-2025.01.01";
Expand Down
Loading
Loading