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 2020/04/03 05:31:14 UTC

[GitHub] [druid] suneet-s opened a new pull request #9611: Use primitives instead of boxed variables when possible

suneet-s opened a new pull request #9611: Use primitives instead of boxed variables when possible
URL: https://github.com/apache/druid/pull/9611
 
 
   Fix LGTM warning about using boxed variables instead of primitives when the
   variable being assigned is never null.
   This change should have no visible production impact, but cleans up the code
   a little bit.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [druid] suneet-s closed pull request #9611: Use primitives instead of boxed variables when possible

Posted by GitBox <gi...@apache.org>.
suneet-s closed pull request #9611: Use primitives instead of boxed variables when possible
URL: https://github.com/apache/druid/pull/9611
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [druid] clintropolis commented on a change in pull request #9611: Use primitives instead of boxed variables when possible

Posted by GitBox <gi...@apache.org>.
clintropolis commented on a change in pull request #9611: Use primitives instead of boxed variables when possible
URL: https://github.com/apache/druid/pull/9611#discussion_r403434803
 
 

 ##########
 File path: core/src/main/java/org/apache/druid/math/expr/Function.java
 ##########
 @@ -1910,16 +1910,10 @@ public String name()
     @Override
     public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings)
     {
-      Long left = args.get(0).eval(bindings).asLong();
-      Long right = args.get(1).eval(bindings).asLong();
+      long left = args.get(0).eval(bindings).asLong();
 
 Review comment:
   Hmm, I actually think this should probably be checking if either result `isNumericNull` and returning a null result before calling `asLong`. Looking around there are ... other places in the functions that have this issue as well, so I don't think you need to fix here.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [druid] clintropolis commented on a change in pull request #9611: Use primitives instead of boxed variables when possible

Posted by GitBox <gi...@apache.org>.
clintropolis commented on a change in pull request #9611: Use primitives instead of boxed variables when possible
URL: https://github.com/apache/druid/pull/9611#discussion_r403434803
 
 

 ##########
 File path: core/src/main/java/org/apache/druid/math/expr/Function.java
 ##########
 @@ -1910,16 +1910,10 @@ public String name()
     @Override
     public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings)
     {
-      Long left = args.get(0).eval(bindings).asLong();
-      Long right = args.get(1).eval(bindings).asLong();
+      long left = args.get(0).eval(bindings).asLong();
 
 Review comment:
   Hmm, I actually think this should probably be checking if either result `isNumericNull` and returning a null result before calling `asLong`. Looking around there are ... other places in the functions that have this issue as well, so I don't think you need to fix here since that is a whole other can of worms.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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