amrishlal commented on a change in pull request #6942:
URL: https://github.com/apache/incubator-pinot/pull/6942#discussion_r635581806



##########
File path: 
pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/QueryValidationTest.java
##########
@@ -131,10 +136,68 @@ private void testUnsupportedPQLQuery(String query, String 
errorMessage) {
   private void testUnsupportedSQLQuery(String query, String errorMessage) {
     try {
       PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
-      BaseBrokerRequestHandler.validateRequest(pinotQuery, 1000);
+      BaseBrokerRequestHandler.validateRequest(pinotQuery, 1000, "testTable", 
null, null);
       Assert.fail("Query should have failed");
     } catch (Exception e) {
       Assert.assertEquals(errorMessage, e.getMessage());
     }
   }
+
+  @Test
+  public void testInvalidColumnNames() {
+    BrokerMetrics brokerMetrics = new 
BrokerMetrics(PinotMetricUtils.getPinotMetricsRegistry());
+    Set<String> columnNamesFromSchema = Sets.newHashSet("column1", "column2", 
"column3");
+
+    String sql = "SELECT * FROM testTable LIMIT 100";
+    Assert.assertEquals(getInvalidColumnNamesCount(sql, columnNamesFromSchema, 
brokerMetrics), 0L);
+
+    sql = "SELECT column1 FROM testTable LIMIT 100";
+    Assert.assertEquals(getInvalidColumnNamesCount(sql, columnNamesFromSchema, 
brokerMetrics), 0L);
+
+    sql = "SELECT column1 FROM testTable WHERE column2 = '1' LIMIT 100";

Review comment:
       Can you also add a few test cases using AS. `For example: SELECT x AS 
column1, y AS column2 FROM testTable`.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to