ccaominh commented on a change in pull request #6974: sql support for dynamic 
parameters
URL: https://github.com/apache/incubator-druid/pull/6974#discussion_r311279806
 
 

 ##########
 File path: sql/src/main/java/org/apache/druid/sql/SqlLifecycle.java
 ##########
 @@ -156,9 +180,9 @@ public PlannerContext plan(HttpServletRequest req)
   public RelDataType rowType()
   {
     synchronized (lock) {
-      Preconditions.checkState(plannerResult != null,
-                               "must be called after sql has been planned");
-      return plannerResult.rowType();
+      Preconditions.checkState(prepareResult != null || plannerResult != null,
+                               "must be called after sql has been prepared");
 
 Review comment:
   The message is not consistent with the condition, since if the SQL has been 
planned, then the precondition is met.
   
   It looks like the only place where `SqlLifecycle#rowType()` is called 
without a preceding call to `SqlLifecycle#plan()` is in 
`DruidStatement#prepare()`. However, in that method, it is possible to directly 
call `PrepareResult#getRowType()` on the return value of the earlier call to 
`SqlLifecycle#prepare()`. If that is done then the changes here are not needed.

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