mirror of https://github.com/apache/druid.git
Fixing expected results for infinity
This commit is contained in:
parent
4d64aaef64
commit
5fd5cd480d
|
@ -37,6 +37,7 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.validation.constraints.Null;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Locale;
|
||||
|
@ -788,8 +789,8 @@ public class FunctionTest extends InitializedNullHandlingTest
|
|||
// NaN and Infinity cases
|
||||
assertExpr("safe_divide(NaN, 0.0)", NullHandling.defaultDoubleValue());
|
||||
assertExpr("safe_divide(0, NaN)", 0.0);
|
||||
assertExpr("safe_divide(0, POSITIVE_INFINITY)", 0L);
|
||||
assertExpr("safe_divide(POSITIVE_INFINITY,0)", 0L);
|
||||
assertExpr("safe_divide(0, POSITIVE_INFINITY)", NullHandling.defaultLongValue());
|
||||
assertExpr("safe_divide(POSITIVE_INFINITY,0)", NullHandling.defaultLongValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -418,7 +418,7 @@ to FLOAT. At runtime, Druid will widen 32-bit floats to 64-bit for most expressi
|
|||
|`HUMAN_READABLE_BINARY_BYTE_FORMAT(value[, precision])`| Format a number in human-readable [IEC](https://en.wikipedia.org/wiki/Binary_prefix) format. For example, HUMAN_READABLE_BINARY_BYTE_FORMAT(1048576) returns `1.00 MiB`. `precision` must be in the range of [0,3] (default: 2). |
|
||||
|`HUMAN_READABLE_DECIMAL_BYTE_FORMAT(value[, precision])`| Format a number in human-readable [SI](https://en.wikipedia.org/wiki/Binary_prefix) format. HUMAN_READABLE_DECIMAL_BYTE_FORMAT(1048576) returns `1.04 MB`. `precision` must be in the range of [0,3] (default: 2). `precision` must be in the range of [0,3] (default: 2). |
|
||||
|`HUMAN_READABLE_DECIMAL_FORMAT(value[, precision])`| Format a number in human-readable SI format. For example, HUMAN_READABLE_DECIMAL_FORMAT(1048576) returns `1.04 M`. `precision` must be in the range of [0,3] (default: 2). |
|
||||
|`SAFE_DIVIDE(x,y)`|Returns the division of x by y guarded on division by 0.In case y is 0 it returns 0, or `null` if `druid.generic.useDefaultValueForNull=false` |
|
||||
|`SAFE_DIVIDE(x,y)`|Returns the division of x by y guarded on division by 0. In case y is 0 it returns 0, or `null` if `druid.generic.useDefaultValueForNull=false` |
|
||||
|
||||
|
||||
### String functions
|
||||
|
|
|
@ -1032,7 +1032,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
expected = ImmutableList.of(
|
||||
new Object[]{null, null, null, 7.0F},
|
||||
new Object[]{1.0F, 1L, 1.0, 3253230.0F},
|
||||
new Object[]{0.0F, 0L, 0, 0.0F},
|
||||
new Object[]{0.0F, 0L, 0.0, 0.0F},
|
||||
new Object[]{null, null, null, null},
|
||||
new Object[]{null, null, null, null},
|
||||
new Object[]{null, null, null, null}
|
||||
|
|
Loading…
Reference in New Issue