Skip to content

Commit e787051

Browse files
Add test to infinity case
1 parent b62b856 commit e787051

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

java/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/ProjectorTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,23 +2155,29 @@ public void testCastVarcharFromFloat() throws Exception {
21552155
999999.9999,
21562156
10000000.0,
21572157
23943410000000.343434,
2158+
Double.POSITIVE_INFINITY,
2159+
Double.NEGATIVE_INFINITY,
2160+
Double.NaN,
21582161
23.45,
21592162
23.45,
21602163
-23.45,
21612164
};
21622165
long[] lenValues =
21632166
new long[] {
21642167
6L, 6L, 6L, 6L, 10L, 15L, 15L, 15L, 30L,
2165-
0L, 6L, 6L
2168+
15L, 15L, 15L, 0L, 6L, 6L
21662169
};
21672170

2168-
/*The Java real numbers are represented in two ways and Gandiva must
2171+
/* The Java real numbers are represented in two ways and Gandiva must
21692172
* follow the same rules:
21702173
* - If the number is greater or equals than 10^7 and less than 10^(-3)
21712174
* it will be represented using scientific notation, e.g:
21722175
* - 0.000012 -> 1.2E-5
21732176
* - 10000002.3 -> 1.00000023E7
21742177
* - If the numbers are between that interval above, they are showed as is.
2178+
*
2179+
* The test checks if the Gandiva function casts the number with the same notation of the
2180+
* Java.
21752181
* */
21762182
String[] expValues =
21772183
new String[] {
@@ -2184,6 +2190,9 @@ public void testCastVarcharFromFloat() throws Exception {
21842190
Double.toString(999999.9999), // must be cast to -> "999999.9999"
21852191
Double.toString(10000000.0), // must be cast to 1E7
21862192
Double.toString(23943410000000.343434),
2193+
Double.toString(Double.POSITIVE_INFINITY),
2194+
Double.toString(Double.NEGATIVE_INFINITY),
2195+
Double.toString(Double.NaN),
21872196
"",
21882197
Double.toString(23.45),
21892198
Double.toString(-23.45)

0 commit comments

Comments
 (0)