clintropolis commented on a change in pull request #9982:
URL: https://github.com/apache/druid/pull/9982#discussion_r437755823



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rel/QueryMaker.java
##########
@@ -126,7 +126,7 @@ public ObjectMapper getJsonMapper()
     return DataSourceAnalysis.forDataSource(query.getDataSource())
                              .getBaseQuerySegmentSpec()
                              .map(QuerySegmentSpec::getIntervals)
-                             .orElse(query.getIntervals());
+                             .orElseGet(query::getIntervals);

Review comment:
       I'm not sure a comment is necessary... I think we should probably always 
use `orElseGet` if the 'else' isn't a primitive because `Optional` must eagerly 
evaluate whatever goes in there. This should maybe be done with some sort of 
static analysis, but I couldn't figure it out in like the 2 minutes I devoted 
to it so far.




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



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

Reply via email to