diff --git a/docs/user/dql/metadata.rst b/docs/user/dql/metadata.rst index 74ce3566c3..d617ce946b 100644 --- a/docs/user/dql/metadata.rst +++ b/docs/user/dql/metadata.rst @@ -44,7 +44,7 @@ SQL query:: | docTestCluster | null | accounts | BASE TABLE | null | null | null | null | null | null | | docTestCluster | null | apache | BASE TABLE | null | null | null | null | null | null | | docTestCluster | null | books | BASE TABLE | null | null | null | null | null | null | - | docTestCluster | null | cities | BASE TABLE | null | null | null | null | null | null | + | docTestCluster | null | flatten | BASE TABLE | null | null | null | null | null | null | | docTestCluster | null | json_test | BASE TABLE | null | null | null | null | null | null | | docTestCluster | null | nested | BASE TABLE | null | null | null | null | null | null | | docTestCluster | null | nyc_taxi | BASE TABLE | null | null | null | null | null | null | diff --git a/docs/user/ppl/cmd/flatten.rst b/docs/user/ppl/cmd/flatten.rst index 98b43ef386..6dbdeff2ab 100644 --- a/docs/user/ppl/cmd/flatten.rst +++ b/docs/user/ppl/cmd/flatten.rst @@ -26,7 +26,7 @@ Example 1: Flatten an object field PPL query:: - os> source=cities | flatten location | fields name, country, province, coordinates, state + os> source=flatten | flatten location | fields name, country, province, coordinates, state fetched rows / total rows = 4/4 +------------------+---------------+------------------+-----------------------------------------------+------------+ | name | country | province | coordinates | state | @@ -42,7 +42,7 @@ Example 2: Flatten multiple object fields PPL query:: - os> source=cities | flatten location | flatten coordinates | fields name, country, province, state, latitude, longitude + os> source=flatten | flatten location | flatten coordinates | fields name, country, province, state, latitude, longitude fetched rows / total rows = 4/4 +------------------+---------------+------------------+------------+----------+-----------+ | name | country | province | state | latitude | longitude | @@ -58,7 +58,7 @@ Example 3: Flatten a nested object field PPL query:: - os> source=cities | flatten location.coordinates | fields name, location + os> source=flatten | flatten location.coordinates | fields name, location fetched rows / total rows = 4/4 +------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | name | location | diff --git a/doctest/test_data/cities.json b/doctest/test_data/flatten.json similarity index 100% rename from doctest/test_data/cities.json rename to doctest/test_data/flatten.json diff --git a/doctest/test_docs.py b/doctest/test_docs.py index 50cfc1c2df..b0a4bc2a09 100644 --- a/doctest/test_docs.py +++ b/doctest/test_docs.py @@ -31,7 +31,7 @@ DATASOURCES = ".ql-datasources" WEBLOGS = "weblogs" JSON_TEST = "json_test" -CITIES = "cities" +FLATTEN = "flatten" class DocTestConnection(OpenSearchConnection): @@ -126,7 +126,7 @@ def set_up_test_indices(test): load_file("datasources.json", index_name=DATASOURCES) load_file("weblogs.json", index_name=WEBLOGS) load_file("json_test.json", index_name=JSON_TEST) - load_file("cities.json", index_name=CITIES) + load_file("flatten.json", index_name=FLATTEN) def load_file(filename, index_name): # Create index with the mapping if mapping file exists @@ -154,7 +154,7 @@ def set_up(test): def tear_down(test): # drop leftover tables after each test - test_data_client.indices.delete(index=[ACCOUNTS, EMPLOYEES, PEOPLE, ACCOUNT2, NYC_TAXI, BOOKS, APACHE, WILDCARD, NESTED, WEBLOGS, JSON_TEST, CITIES], ignore_unavailable=True) + test_data_client.indices.delete(index=[ACCOUNTS, EMPLOYEES, PEOPLE, ACCOUNT2, NYC_TAXI, BOOKS, APACHE, WILDCARD, NESTED, WEBLOGS, JSON_TEST, FLATTEN], ignore_unavailable=True) docsuite = partial(doctest.DocFileSuite, diff --git a/doctest/test_mapping/cities.json b/doctest/test_mapping/flatten.json similarity index 100% rename from doctest/test_mapping/cities.json rename to doctest/test_mapping/flatten.json diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java b/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java index 9c877c52de..4bb790a758 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java @@ -11,7 +11,7 @@ import static org.opensearch.sql.legacy.TestUtils.getAliasIndexMapping; import static org.opensearch.sql.legacy.TestUtils.getBankIndexMapping; import static org.opensearch.sql.legacy.TestUtils.getBankWithNullValuesIndexMapping; -import static org.opensearch.sql.legacy.TestUtils.getCitiesIndexMapping; +import static org.opensearch.sql.legacy.TestUtils.getFlattenIndexMapping; import static org.opensearch.sql.legacy.TestUtils.getDataTypeNonnumericIndexMapping; import static org.opensearch.sql.legacy.TestUtils.getDataTypeNumericIndexMapping; import static org.opensearch.sql.legacy.TestUtils.getDateIndexMapping; @@ -760,11 +760,11 @@ public enum Index { "json", getJsonTestIndexMapping(), "src/test/resources/json_test.json"), - CITIES( - TestsConstants.TEST_INDEX_CITIES, - "cities", - getCitiesIndexMapping(), - "src/test/resources/cities.json"), + FLATTEN( + TestsConstants.TEST_INDEX_FLATTEN, + "flatten", + getFlattenIndexMapping(), + "src/test/resources/flatten.json"), DATA_TYPE_ALIAS( TestsConstants.TEST_INDEX_ALIAS, "alias", diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/TestUtils.java b/integ-test/src/test/java/org/opensearch/sql/legacy/TestUtils.java index af62936b92..e3b8d21793 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/TestUtils.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/TestUtils.java @@ -265,8 +265,8 @@ public static String getAliasIndexMapping() { return getMappingFile(mappingFile); } - public static String getCitiesIndexMapping() { - String mappingFile = "cities.mapping.json"; + public static String getFlattenIndexMapping() { + String mappingFile = "flatten_mapping.json"; return getMappingFile(mappingFile); } diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/TestsConstants.java b/integ-test/src/test/java/org/opensearch/sql/legacy/TestsConstants.java index b421efc47f..0739628a41 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/TestsConstants.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/TestsConstants.java @@ -60,7 +60,7 @@ public class TestsConstants { public static final String TEST_INDEX_GEOPOINT = TEST_INDEX + "_geopoint"; public static final String TEST_INDEX_JSON_TEST = TEST_INDEX + "_json_test"; public static final String TEST_INDEX_ALIAS = TEST_INDEX + "_alias"; - public static final String TEST_INDEX_CITIES = TEST_INDEX + "_cities"; + public static final String TEST_INDEX_FLATTEN = TEST_INDEX + "_flatten"; public static final String TEST_INDEX_GEOIP = TEST_INDEX + "_geoip"; public static final String DATASOURCES = ".ql-datasources"; diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainIT.java index 6fb30a3b26..c98d879230 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/ExplainIT.java @@ -5,7 +5,7 @@ package org.opensearch.sql.ppl; -import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_CITIES; +import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_FLATTEN; import static org.opensearch.sql.util.MatcherUtils.assertJsonEquals; import com.google.common.io.Resources; @@ -21,7 +21,7 @@ public class ExplainIT extends PPLIntegTestCase { @Override public void init() throws IOException { loadIndex(Index.ACCOUNT); - loadIndex(Index.CITIES); + loadIndex(Index.FLATTEN); } @Test @@ -131,7 +131,7 @@ public void testTrendlineWithSortPushDownExplain() throws Exception { @Test public void testFlatten() throws Exception { - String query = StringUtils.format("source=%s | flatten location", TEST_INDEX_CITIES); + String query = StringUtils.format("source=%s | flatten location", TEST_INDEX_FLATTEN); String actual = explainQueryToString(query); String expected = loadFromFile("expectedOutput/ppl/explain_flatten.json"); assertJsonEquals(expected, actual); diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/FlattenCommandIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/FlattenCommandIT.java index 65816bcb3f..131f1a60b6 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/FlattenCommandIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/FlattenCommandIT.java @@ -5,7 +5,7 @@ package org.opensearch.sql.ppl; -import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_CITIES; +import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_FLATTEN; import static org.opensearch.sql.util.MatcherUtils.rows; import static org.opensearch.sql.util.MatcherUtils.schema; import static org.opensearch.sql.util.MatcherUtils.verifyDataRows; @@ -21,7 +21,7 @@ public class FlattenCommandIT extends PPLIntegTestCase { @Override public void init() throws IOException { - loadIndex(Index.CITIES); + loadIndex(Index.FLATTEN); } @Test @@ -29,7 +29,7 @@ public void testBasic() throws IOException { String query = StringUtils.format( "source=%s | flatten location | fields name, country, province, coordinates, state", - TEST_INDEX_CITIES); + TEST_INDEX_FLATTEN); JSONObject result = executeQuery(query); verifySchema( @@ -63,7 +63,7 @@ public void testMultiple() throws IOException { StringUtils.format( "source=%s | flatten location | flatten coordinates | fields name, country, province," + " state, latitude, longitude", - TEST_INDEX_CITIES); + TEST_INDEX_FLATTEN); JSONObject result = executeQuery(query); verifySchema( @@ -86,7 +86,7 @@ public void testMultiple() throws IOException { public void testNested() throws IOException { String query = StringUtils.format( - "source=%s | flatten location.coordinates | fields name, location", TEST_INDEX_CITIES); + "source=%s | flatten location.coordinates | fields name, location", TEST_INDEX_FLATTEN); JSONObject result = executeQuery(query); verifySchema(result, schema("name", "string"), schema("location", "struct")); diff --git a/integ-test/src/test/resources/expectedOutput/ppl/explain_flatten.json b/integ-test/src/test/resources/expectedOutput/ppl/explain_flatten.json index b729bf415f..bbc731160f 100644 --- a/integ-test/src/test/resources/expectedOutput/ppl/explain_flatten.json +++ b/integ-test/src/test/resources/expectedOutput/ppl/explain_flatten.json @@ -20,7 +20,7 @@ { "name": "OpenSearchIndexScan", "description": { - "request": "OpenSearchQueryRequest(indexName=opensearch-sql_test_index_cities, sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\"}, needClean=true, searchDone=false, pitId=null, cursorKeepAlive=null, searchAfter=null, searchResponse=null)" + "request": "OpenSearchQueryRequest(indexName=opensearch-sql_test_index_flatten, sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\"}, needClean=true, searchDone=false, pitId=null, cursorKeepAlive=null, searchAfter=null, searchResponse=null)" }, "children": [] } diff --git a/integ-test/src/test/resources/cities.json b/integ-test/src/test/resources/flatten.json similarity index 100% rename from integ-test/src/test/resources/cities.json rename to integ-test/src/test/resources/flatten.json diff --git a/integ-test/src/test/resources/indexDefinitions/cities_mapping.json b/integ-test/src/test/resources/indexDefinitions/flatten_mapping.json similarity index 100% rename from integ-test/src/test/resources/indexDefinitions/cities_mapping.json rename to integ-test/src/test/resources/indexDefinitions/flatten_mapping.json