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/04/12 07:39:08 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #11088: add round test

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



##########
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:
       nit: could use `StringUtils.format(...)`




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



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