You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/11/09 21:33:36 UTC

[GitHub] [pinot] jackjlli commented on a change in pull request #7568: EXPLAIN PLAN

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



##########
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'\"}");

Review comment:
       `ObjectMapper` can be instantiated only once. 

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/plan/FilterPlanNode.java
##########
@@ -217,9 +216,9 @@ private BaseFilterOperator constructPhysicalOperator(FilterContext filter) {
               return FilterOperatorUtils.getLeafFilterOperator(predicateEvaluator, dataSource, _numDocs);
             case JSON_MATCH:
               JsonIndexReader jsonIndex = dataSource.getJsonIndex();
-              Preconditions.checkState(jsonIndex != null, "Cannot apply JSON_MATCH on column: %s without json index",
-                  column);
-              return new JsonMatchFilterOperator(jsonIndex, ((JsonMatchPredicate) predicate).getValue(), _numDocs);
+              Preconditions
+                  .checkState(jsonIndex != null, "Cannot apply JSON_MATCH on column: %s without json index", column);

Review comment:
       Can be replaced with `Preconditions.checkNotNull();`




-- 
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-unsubscribe@pinot.apache.org

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



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