-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SHOW CATALOGS documentation and integ tests
Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
- Loading branch information
1 parent
ccc2230
commit d513fc5
Showing
7 changed files
with
128 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
============= | ||
show catalogs | ||
============= | ||
|
||
.. rubric:: Table of contents | ||
|
||
.. contents:: | ||
:local: | ||
:depth: 2 | ||
|
||
|
||
Description | ||
============ | ||
| Using ``show catalogs`` command to query catalogs configured in the PPL engine. ``show catalogs`` command could be only used as the first command in the PPL query. | ||
|
||
Syntax | ||
============ | ||
show catalogs | ||
|
||
|
||
Example 1: Fetch all PROMETHEUS catalogs | ||
================================= | ||
|
||
The example fetches all the catalogs configured. | ||
|
||
PPL query for all PROMETHEUS CATALOGS:: | ||
|
||
os> show catalogs | where CONNECTOR_TYPE='PROMETHEUS'; | ||
fetched rows / total rows = 1/1 | ||
+----------------+------------------+ | ||
| CATALOG_NAME | CONNECTOR_TYPE | | ||
|----------------+------------------| | ||
| prometheus | PROMETHEUS | | ||
+----------------+------------------+ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
integ-test/src/test/java/org/opensearch/sql/ppl/ShowCatalogsCommandIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* | ||
* * Copyright OpenSearch Contributors | ||
* * SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.opensearch.sql.ppl; | ||
|
||
import static org.opensearch.sql.util.MatcherUtils.columnName; | ||
import static org.opensearch.sql.util.MatcherUtils.rows; | ||
import static org.opensearch.sql.util.MatcherUtils.verifyColumn; | ||
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows; | ||
|
||
import java.io.IOException; | ||
import org.json.JSONObject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class ShowCatalogsCommandIT extends PPLIntegTestCase { | ||
|
||
@Test | ||
public void testShowCatalogsCommands() throws IOException { | ||
JSONObject result = executeQuery("show catalogs"); | ||
verifyDataRows(result, | ||
rows("prometheus", "PROMETHEUS"), | ||
rows(".opensearch", "OPENSEARCH")); | ||
verifyColumn( | ||
result, | ||
columnName("CATALOG_NAME"), | ||
columnName("CONNECTOR_TYPE") | ||
); | ||
} | ||
|
||
@Test | ||
public void testShowCatalogsCommandsWithWhereClause() throws IOException { | ||
JSONObject result = executeQuery("show catalogs | where CONNECTOR_TYPE='PROMETHEUS'"); | ||
verifyDataRows(result, | ||
rows("prometheus", "PROMETHEUS")); | ||
verifyColumn( | ||
result, | ||
columnName("CATALOG_NAME"), | ||
columnName("CONNECTOR_TYPE") | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"name" : "prometheus", | ||
"connector": "prometheus", | ||
"uri" : "http://localhost:9090" | ||
} | ||
] |