From 40da861fd27947c74011ee407555655832f17adc Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Tue, 9 Jan 2024 18:08:55 +0100 Subject: [PATCH] Drop legacy full-text search support --- docs/src/main/sphinx/connector/opensearch.md | 10 ---------- .../plugin/opensearch/OpenSearchMetadata.java | 11 ++--------- .../opensearch/BaseOpenSearchConnectorTest.java | 16 ---------------- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/docs/src/main/sphinx/connector/opensearch.md b/docs/src/main/sphinx/connector/opensearch.md index 544ce9bb2275..4885edcb0a27 100644 --- a/docs/src/main/sphinx/connector/opensearch.md +++ b/docs/src/main/sphinx/connector/opensearch.md @@ -317,16 +317,6 @@ The following hidden columns are available: | \_score | The document score returned by the OpenSearch query | | \_source | The source of the original document | -(opensearch-full-text-queries)= -## Full text queries - -Trino SQL queries can be combined with OpenSearch queries by providing the [full text query] -as part of the table name, separated by a colon. For example: - -```sql -SELECT * FROM "tweets: +trino SQL^2" -``` - ## Predicate push down The connector supports [predicate push down](predicate-pushdown) for the following data types: diff --git a/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/OpenSearchMetadata.java b/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/OpenSearchMetadata.java index 9da43db40eca..d013f117e7c8 100644 --- a/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/OpenSearchMetadata.java +++ b/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/OpenSearchMetadata.java @@ -152,15 +152,8 @@ public OpenSearchTableHandle getTableHandle(ConnectorSession session, SchemaTabl requireNonNull(tableName, "tableName is null"); if (tableName.getSchemaName().equals(schemaName)) { - String[] parts = tableName.getTableName().split(":", 2); - String table = parts[0]; - Optional query = Optional.empty(); - if (parts.length == 2) { - query = Optional.of(parts[1]); - } - - if (client.indexExists(table) && !client.getIndexMetadata(table).getSchema().getFields().isEmpty()) { - return new OpenSearchTableHandle(OpenSearchTableHandle.Type.SCAN, schemaName, table, query); + if (client.indexExists(tableName.getTableName()) && !client.getIndexMetadata(tableName.getTableName()).getSchema().getFields().isEmpty()) { + return new OpenSearchTableHandle(OpenSearchTableHandle.Type.SCAN, schemaName, tableName.getTableName(), Optional.empty()); } } diff --git a/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/BaseOpenSearchConnectorTest.java b/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/BaseOpenSearchConnectorTest.java index 80c00b075e3e..3e727a8facb0 100644 --- a/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/BaseOpenSearchConnectorTest.java +++ b/plugin/trino-opensearch/src/test/java/io/trino/plugin/opensearch/BaseOpenSearchConnectorTest.java @@ -1468,9 +1468,6 @@ public void testFilters() .put("ipv6_column", "2001:db8:0:0:1:0:0:1") .buildOrThrow()); - // _score column - assertQuery("SELECT count(*) FROM \"filter_pushdown: cool\" WHERE _score > 0", "VALUES 1"); - // boolean assertQuery("SELECT count(*) FROM filter_pushdown WHERE boolean_column = true", "VALUES 1"); assertQuery("SELECT count(*) FROM filter_pushdown WHERE boolean_column = false", "VALUES 0"); @@ -1692,12 +1689,6 @@ public void testNestedTypeDataTypesNested() assertThat(rows.getMaterializedRows()).isEqualTo(expected.getMaterializedRows()); } - @Test - public void testQueryString() - { - assertQuery("SELECT count(*) FROM \"orders: +packages -slyly\"", "VALUES 1639"); - } - @Test public void testMixedCase() throws IOException @@ -1740,13 +1731,6 @@ public void testNumericKeyword() "VALUES 20"); } - @Test - public void testQueryStringError() - { - assertQueryFails("SELECT orderkey FROM \"orders: ++foo AND\"", "\\QFailed to parse query [ ++foo and]\\E"); - assertQueryFails("SELECT count(*) FROM \"orders: ++foo AND\"", "\\QFailed to parse query [ ++foo and]\\E"); - } - @Test public void testAlias() throws IOException