Skip to content
Merged
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
1 change: 0 additions & 1 deletion DEVELOPER_GUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ For test cases, you can use the cases in the following checklist in case you mis

- *Other Statements*

- DELETE
- SHOW
- DESCRIBE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public enum Key {
SQL_ENABLED("plugins.sql.enabled"),
SQL_SLOWLOG("plugins.sql.slowlog"),
SQL_CURSOR_KEEP_ALIVE("plugins.sql.cursor.keep_alive"),
SQL_DELETE_ENABLED("plugins.sql.delete.enabled"),
SQL_PAGINATION_API_SEARCH_AFTER("plugins.sql.pagination.api"),

/** PPL Settings. */
Expand Down
55 changes: 0 additions & 55 deletions docs/user/admin/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,61 +260,6 @@ Result set::
"transient": {}
}

plugins.sql.delete.enabled
======================

Description
-----------

By default, DELETE clause disabled. You can enable DELETE clause by this setting.

1. The default value is false.
2. This setting is node scope.
3. This setting can be updated dynamically.


Example 1
---------

You can update the setting with a new value like this.

SQL query::

sh$ curl -sS -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_query/settings \
... -d '{"transient":{"plugins.sql.delete.enabled":"false"}}'
{
"acknowledged": true,
"persistent": {},
"transient": {
"plugins": {
"sql": {
"delete": {
"enabled": "false"
}
}
}
}
}

Example 2
---------

Query result after the setting updated is like:

SQL query::

sh$ curl -sS -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql \
... -d '{"query" : "DELETE * FROM accounts"}'
{
"error": {
"reason": "Invalid SQL query",
"details": "DELETE clause is disabled by default and will be deprecated. Using the plugins.sql.delete.enabled setting to enable it",
"type": "SQLFeatureDisabledException"
},
"status": 400
}


plugins.query.executionengine.spark.session.limit
==================================================

Expand Down
87 changes: 0 additions & 87 deletions docs/user/dml/delete.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/user/dql/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ Description

For ``LIKE`` and other full text search topics, please refer to Full Text Search documentation.

Besides SQL query, WHERE clause can also be used in SQL statement such as ``DELETE``. Please refer to Data Manipulation Language documentation for details.

Example 1: Comparison Operators
-------------------------------

Expand Down
4 changes: 0 additions & 4 deletions docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ OpenSearch SQL enables you to extract insights out of OpenSearch using the famil

- `Window Functions <dql/window.rst>`_

* **Data Manipulation Language**

- `DELETE Statement <dml/delete.rst>`_

* **Beyond SQL**

- `PartiQL (JSON) Support <beyond/partiql.rst>`_
Expand Down
139 changes: 0 additions & 139 deletions integ-test/src/test/java/org/opensearch/sql/legacy/DeleteIT.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,6 @@ public void searchSanityFilter() throws IOException {
result.replaceAll("\\s+", ""), equalTo(expectedOutput.replaceAll("\\s+", "")));
}

@Test
public void deleteSanity() throws IOException {

String expectedOutputFilePath =
TestUtils.getResourceFilePath("src/test/resources/expectedOutput/delete_explain.json");
String expectedOutput =
Files.toString(new File(expectedOutputFilePath), StandardCharsets.UTF_8)
.replaceAll("\r", "");
;

String result =
explainQuery(
String.format(
"DELETE FROM %s WHERE firstname LIKE 'A%%' AND age > 20", TEST_INDEX_ACCOUNT));
Assert.assertThat(
result.replaceAll("\\s+", ""), equalTo(expectedOutput.replaceAll("\\s+", "")));
}

@Test
public void spatialFilterExplainTest() throws IOException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import org.opensearch.client.RequestOptions;
import org.opensearch.client.Response;
import org.opensearch.client.ResponseException;
import org.opensearch.sql.common.setting.Settings;
import org.opensearch.sql.legacy.utils.StringUtils;
import org.opensearch.sql.plugin.rest.RestQuerySettingsAction;

public class PluginIT extends SQLIntegTestCase {
Expand Down Expand Up @@ -59,31 +57,6 @@ public void sqlEnableSettingsTest() throws IOException {
wipeAllClusterSettings();
}

@Test
public void sqlDeleteSettingsTest() throws IOException {
updateClusterSettings(
new ClusterSetting(PERSISTENT, Settings.Key.SQL_DELETE_ENABLED.getKeyValue(), "false"));

String deleteQuery = StringUtils.format("DELETE FROM %s", TestsConstants.TEST_INDEX_ACCOUNT);
final ResponseException exception =
expectThrows(ResponseException.class, () -> executeQuery(deleteQuery));
JSONObject actual = new JSONObject(TestUtils.getResponseBody(exception.getResponse()));
JSONObject expected =
new JSONObject(
"{\n"
+ " \"error\": {\n"
+ " \"reason\": \"Invalid SQL query\",\n"
+ " \"details\": \"DELETE clause is disabled by default and will be deprecated."
+ " Using the plugins.sql.delete.enabled setting to enable it\",\n"
+ " \"type\": \"SQLFeatureDisabledException\"\n"
+ " },\n"
+ " \"status\": 400\n"
+ "}");
assertTrue(actual.toString(), actual.similar(expected));

wipeAllClusterSettings();
}

@Test
public void sqlTransientOnlySettingTest() throws IOException {
// (1) compact form
Expand Down
Loading
Loading