asdf2014 commented on a change in pull request #8775: Fix NPE for subquery with 
limit
URL: https://github.com/apache/incubator-druid/pull/8775#discussion_r341891682
 
 

 ##########
 File path: sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
 ##########
 @@ -7344,6 +7344,36 @@ public void testUsingSubqueryWithExtractionFns() throws 
Exception
     );
   }
 
+  @Test
+  public void testUsingSubqueryWithLimit() throws Exception
+  {
+    testQuery(
+        "SELECT COUNT(*) AS cnt FROM ( SELECT * FROM druid.foo LIMIT 10 ) 
tmpA",
 
 Review comment:
   In fact, there is no exception thrown here. Normally, the 
`DruidOuterQueryRel#toDruidQuery` called in the `DruidOuterQueryRel#runQuery` 
method will return a non-empty DruidQuery instance, after which the program 
will go to the first branch of if-else, call `QueryMaker#runQuery` and perform 
a structural check. However, as you said before, when GroupByQuery is empty, 
`DruidOuterQueryRel#toDruidQuery` will return null directly, so that the 
program will go to the second branch of if-else, no check will be performed, it 
will be directly Return to Sequences.empty(). Therefore, no error will be 
thrown. :thinking:

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


With regards,
Apache Git Services

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

Reply via email to