This is an automated email from the ASF dual-hosted git repository.
gortiz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 35bb12a230 Add tests for DUAL as well as non-compliant DUAL with
unknown table (#15260)
35bb12a230 is described below
commit 35bb12a230bb855d8b0651848ba36912f7fb9612
Author: Rajat Venkatesh <[email protected]>
AuthorDate: Thu Mar 13 19:01:08 2025 +0530
Add tests for DUAL as well as non-compliant DUAL with unknown table (#15260)
Dual behaviour in SSE is non-compliant. However the non-compliant query
`select 1 from unknownTable` is used in production. This PR adds tests
to detect changes that may change this non-compliant SQL
---
.../tests/MultiStageEngineIntegrationTest.java | 22 +++++++++++++++
.../tests/OfflineClusterIntegrationTest.java | 31 ++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
index 7600ef4103..c295efe49a 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
@@ -327,6 +327,28 @@ public class MultiStageEngineIntegrationTest extends
BaseClusterIntegrationTestS
Assert.assertTrue(jsonNode.get("resultTable").get("rows").get(0).get(0).asDouble()
< 17000);
}
+ @Test
+ void testDual()
+ throws Exception {
+ setUseMultiStageQueryEngine(true);
+ JsonNode queryResponse = postQuery("SELECT 1");
+ Assert.assertTrue(queryResponse.get("exceptions").isEmpty());
+ Assert.assertEquals(queryResponse.get("numRowsResultSet").asInt(), 1);
+ }
+
+ /**
+ * This test is added because SSE engine supports it and is used in
production.
+ * Make sure that the difference in support is well-documented.
+ */
+ @Test
+ void testDualWithNotExistsTableMSE()
+ throws Exception {
+ setUseMultiStageQueryEngine(true);
+ JsonNode queryResponse = postQuery("SELECT 1 from notExistsTable");
+
Assert.assertEquals(queryResponse.get("exceptions").get(0).get("errorCode").asInt(),
+ QueryErrorCode.QUERY_PLANNING.getId()); // TODO: The right error is
TABLE_DOES_NOT_EXIST
+ }
+
@Test
public void testTimeFunc()
throws Exception {
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
index b11c5c854d..d5e09a6a9c 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
@@ -3164,6 +3164,24 @@ public class OfflineClusterIntegrationTest extends
BaseClusterIntegrationTestSet
assertFalse(_propertyStore.exists(configPath, 0));
}
+ @Test
+ void testDual()
+ throws Exception {
+ setUseMultiStageQueryEngine(false);
+ JsonNode queryResponse = postQuery("SELECT 1");
+ Assert.assertTrue(queryResponse.get("exceptions").isEmpty());
+ Assert.assertEquals(queryResponse.get("numRowsResultSet").asInt(), 1);
+ }
+
+ @Test
+ void testDualWithNotExistsTableSSE()
+ throws Exception {
+ setUseMultiStageQueryEngine(false);
+ JsonNode queryResponse = postQuery("SELECT 1 from notExistsTable");
+ Assert.assertTrue(queryResponse.get("exceptions").isEmpty());
+ Assert.assertEquals(queryResponse.get("numRowsResultSet").asInt(), 1);
+ }
+
@Test(dataProvider = "useBothQueryEngines")
public void testDistinctQuery(boolean useMultiStageQueryEngine)
throws Exception {
@@ -3835,6 +3853,19 @@ public class OfflineClusterIntegrationTest extends
BaseClusterIntegrationTestSet
Assert.assertTrue(connection.isClosed());
}
+ @Test
+ public void testNonExistingTableQueryThroughJDBCClient()
+ throws Exception {
+ String query = "SELECT 1 from nonExistingTable";
+ java.sql.Connection connection =
getJDBCConnectionFromController(getControllerPort());
+ Statement statement = connection.createStatement();
+ ResultSet resultSet = statement.executeQuery(query);
+ resultSet.first();
+ Assert.assertTrue(resultSet.getLong(1) > 0);
+ connection.close();
+ Assert.assertTrue(connection.isClosed());
+ }
+
private java.sql.Connection getJDBCConnectionFromController(int
controllerPort)
throws Exception {
PinotDriver pinotDriver = new PinotDriver();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]