yupeng9 commented on a change in pull request #7590:
URL: https://github.com/apache/pinot/pull/7590#discussion_r733804365
##########
File path:
pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/QueryValidationTest.java
##########
@@ -120,6 +122,38 @@ public void testUnsupportedDistinctQueries() {
testUnsupportedPQLQuery(pql, "Aggregation functions cannot be used with
DISTINCT");
}
+ @Test
+ public void testUnsupportedNonExistColumnsQueries() {
+ String sql = "SELECT DISTINCT(col1, col2) FROM foo
OPTION(groupByMode=sql,responseFormat=sql)";
+ testNonExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1",
"col1"), sql,
+ "Unknown columnName 'col2' found in the query");
+ testNonExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col2",
"col2"), sql,
+ "Unknown columnName 'col1' found in the query");
+ testExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col2", "col2",
"col1", "col1"), sql);
+ sql = "SELECT sum(Col1) FROM foo
OPTION(groupByMode=sql,responseFormat=sql)";
+ testNonExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1",
"col1"), sql,
+ "Unknown columnName 'Col1' found in the query");
+ testExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1", "Col1"),
sql);
+ testExistedColumnInSQLQuery("foo", true, ImmutableMap.of("col1", "col1"),
sql);
+ sql = "SELECT sum(Col1) AS sum_col1 FROM foo
OPTION(groupByMode=sql,responseFormat=sql)";
+ testNonExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1",
"col1"), sql,
+ "Unknown columnName 'Col1' found in the query");
+ testExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1", "Col1"),
sql);
+ testExistedColumnInSQLQuery("foo", true, ImmutableMap.of("col1", "col1"),
sql);
+ sql = "SELECT sum(Col1) AS sum_col1 FROM foo HAVING sum_col1 > 10
OPTION(groupByMode=sql,responseFormat=sql)";
+ testNonExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1",
"col1"), sql,
+ "Unknown columnName 'Col1' found in the query");
+ testExistedColumnInSQLQuery("foo", false, ImmutableMap.of("col1", "Col1"),
sql);
+ testExistedColumnInSQLQuery("foo", true, ImmutableMap.of("col1", "col1"),
sql);
+ sql =
+ "SELECT sum(Col1) AS sum_col1, b AS B, c as D FROM foo GROUP BY B, D
OPTION(groupByMode=sql,"
Review comment:
shall we have a test to show `SELECT sum(Col1) AS sum_col1, b AS B, c as
D FROM foo GROUP BY 2, 3` also works?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]