himanshug commented on a change in pull request #8373: Speed up
ExpressionSelectors.makeExprEvalSelector
URL: https://github.com/apache/incubator-druid/pull/8373#discussion_r316896094
##########
File path: core/src/main/java/org/apache/druid/math/expr/Expr.java
##########
@@ -356,42 +354,42 @@ public BindingDetails withScalarArguments(Set<Expr>
scalarArguments)
* Add set of arguments as {@link BindingDetails#arrayVariables} that are
*directly* {@link IdentifierExpr},
* else they are ignored.
*/
- public BindingDetails withArrayArguments(Set<Expr> arrayArguments)
+ BindingDetails withArrayArguments(Set<Expr> arrayArguments)
{
Set<IdentifierExpr> arrayIdentifiers = new HashSet<>();
for (Expr expr : arrayArguments) {
- final IdentifierExpr isIdentifier =
expr.getIdentifierExprIfIdentifierExpr();
- if (isIdentifier != null) {
+ final boolean isIdentifierExpr =
expr.getIdentifierExprIfIdentifierExpr() != null;
+ if (isIdentifierExpr) {
arrayIdentifiers.add((IdentifierExpr) expr);
}
}
return new BindingDetails(
ImmutableSet.copyOf(Sets.union(freeVariables, arrayIdentifiers)),
scalarVariables,
ImmutableSet.copyOf(Sets.union(arrayVariables, arrayIdentifiers)),
- hasInputArrays || arrayArguments.size() > 0,
+ hasInputArrays || !arrayArguments.isEmpty(),
Review comment:
ok, rationale about isEmpty() in general being more efficient makes sense .
----------------------------------------------------------------
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]