-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Java] Added a few more tests for Decimal to String cast #9818
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3376,16 +3376,30 @@ void testFixedWidthCast() { | |
void testCastBigDecimalToString() { | ||
BigDecimal[] bigValues = {new BigDecimal("923121331938210123.321"), | ||
new BigDecimal("9223372036854775808.191"), | ||
new BigDecimal("-9.223"), | ||
new BigDecimal("0.000"), | ||
new BigDecimal("9328323982309091029831.002") | ||
}; | ||
|
||
try (ColumnVector cv = ColumnVector.fromDecimals(bigValues); | ||
ColumnVector values = cv.castTo(DType.STRING); | ||
ColumnVector expected = ColumnVector.fromStrings("923121331938210123.321", | ||
"9223372036854775808.191", | ||
"9328323982309091029831.002")) { | ||
"-9.223", | ||
"0.000", | ||
"9328323982309091029831.002")) { | ||
assertColumnsAreEqual(expected, values); | ||
} | ||
|
||
BigDecimal[] bigValues0 = {new BigDecimal("992983283728193827182918744829283742232")}; | ||
try { | ||
ColumnVector cv = ColumnVector.fromDecimals(bigValues0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we make sure that this didn't leak? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Obviously we should! |
||
if (cv != null) { | ||
cv.close(); | ||
} | ||
Comment on lines
+3397
to
+3399
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not |
||
fail("Precision check should've thrown an IllegalArgumentException"); | ||
} catch (IllegalArgumentException iae) { | ||
} | ||
} | ||
|
||
@Test | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a test case for a negative decimal value greater than 64 bits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that will accomplish is to verify that Java BigDecimals > 64 bit have precision > 38