amrishlal commented on a change in pull request #7568:
URL: https://github.com/apache/pinot/pull/7568#discussion_r746093798



##########
File path: 
pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/LiteralOnlyBrokerRequestTest.java
##########
@@ -177,4 +177,55 @@ public void testBrokerRequestHandlerWithAsFunction()
     Assert.assertEquals(brokerResponse.getResultTable().getRows().get(0)[1], 
1577836800000L);
     Assert.assertEquals(brokerResponse.getTotalDocs(), 0);
   }
+
+  /** Tests for EXPLAIN PLAN for literal only queries. */
+  @Test
+  public void testExplainPlanLiteralOnly()
+      throws Exception {
+    SingleConnectionBrokerRequestHandler requestHandler =
+        new SingleConnectionBrokerRequestHandler(new PinotConfiguration(), 
null, ACCESS_CONTROL_FACTORY, null, null,
+            new BrokerMetrics("", PinotMetricUtils.getPinotMetricsRegistry(), 
true, Collections.emptySet()), null);
+
+    // Test 1: select constant
+    JsonNode request = new ObjectMapper().readTree("{\"sql\":\"EXPLAIN PLAN 
FOR SELECT 1.5, 'test'\"}");
+    RequestStatistics requestStats = new RequestStatistics();
+    BrokerResponseNative brokerResponse = 
requestHandler.handleRequest(request, null, requestStats);
+
+    checkExplainResultSchema(brokerResponse.getResultTable().getDataSchema(),
+        new String[]{"Operator", "Operator_Id", "Parent_Id"},
+        new DataSchema.ColumnDataType[]{DataSchema.ColumnDataType.STRING, 
DataSchema.ColumnDataType.INT,
+            DataSchema.ColumnDataType.INT});
+
+    Assert.assertEquals(brokerResponse.getResultTable().getRows().size(), 1);
+    Assert.assertEquals(brokerResponse.getResultTable().getRows().get(0),
+        new Object[]{"SELECT(selectList:literal)", 0, -1});

Review comment:
       1.5 is also a literal, so same reason as last comment.




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to