clintropolis commented on a change in pull request #11088:
URL: https://github.com/apache/druid/pull/11088#discussion_r612130172
##########
File path: core/src/test/java/org/apache/druid/math/expr/FunctionTest.java
##########
@@ -407,12 +407,40 @@ public void testRoundWithExtremeNumbers()
assertExpr("round(CAST(minLong, 'DOUBLE') - 1, -2)",
BigDecimal.valueOf(((double) Long.MIN_VALUE) - 1).setScale(-2,
RoundingMode.HALF_UP).doubleValue());
}
+ @Test
+ public void testRoundWithNullValue()
+ {
+ Set<Pair<String, String>> invalidArguments = ImmutableSet.of(
+ Pair.of("null", "STRING"),
+ Pair.of("x", "STRING")
+ );
+ for (Pair<String, String> argAndType : invalidArguments) {
+ if (NullHandling.sqlCompatible()) {
+ assertExpr(String.format(Locale.ENGLISH, "round(%s)", argAndType.lhs),
null);
Review comment:
Oh, I meant we have a utility function that does this format with locale
stuff,
https://github.com/apache/druid/blob/master/core/src/main/java/org/apache/druid/java/util/common/StringUtils.java#L166
that could be used to make this a bit shorter, but since is a test it isn't a
big deal whether or not you change to use it
--
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]