You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/11/10 01:26:00 UTC

[GitHub] [druid] jihoonson commented on a change in pull request #11900: Fix NPE for SQL queries when a query parameter is missing in the mid

jihoonson commented on a change in pull request #11900:
URL: https://github.com/apache/druid/pull/11900#discussion_r746175671



##########
File path: sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java
##########
@@ -36,7 +36,10 @@
   public static List<TypedValue> getParameterList(List<SqlParameter> parameters)
   {
     return parameters.stream()
-                     .map(SqlParameter::getTypedValue)
+                     // null params are not good!
+                     // we pass them to the planner, so that it can generate a proper error message.
+                     // see SqlParameterizerShuttle and RelParameterizerShuttle.
+                     .map(p -> p == null ? null : p.getTypedValue())

Review comment:
       The intention was passing null parameters as they are so that `SqlParameterizerShuttle` and `RelParameterizerShuttle` can handle them properly. They will throw `InvalidArgumentException` at https://github.com/apache/druid/pull/11900/files#diff-ae4b6e9293a80177b076ab1a7d6235931eb95619dcc759ae40027543ef35f4e1R215 or https://github.com/apache/druid/pull/11900/files#diff-9ea07312c8d034ebe3c983a4690dd3cb79a2aa190610b11583cf37947f919de9R75. Do you think it's better to throw an exception here too? I thought it would be better to put error handling logic in one place. 




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

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



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