Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public class VariantNonNull extends VariantSqlValue {
break;
}
case BIGINT: {
long l = (int) value;
long l = (long) value;
switch (type.getTypeName()) {
case TINYINT:
case SMALLINT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,8 @@ void testCastToBoolean(CastType castType, SqlOperatorFixture f) {
"INTEGER ARRAY");
f.checkScalar("cast(cast('abc' as VARIANT) AS VARCHAR)", "abc", "VARCHAR");
f.checkScalar("cast(cast('abc' as VARIANT) AS CHAR(3))", "abc", "CHAR(3)");
// Test for [CALCITE-7398] Incorrect int cast in VariantNonNull#cast for BIGINT
f.checkScalar("cast(cast(2147483648 as VARIANT) as DECIMAL)", "2147483648", "DECIMAL(19, 0)");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the bug fix way is OK,but please note:

  1. Your commit message should not contain words like "Fix," and you need to modify the Jira link content to match the PR.
  2. It is recommended to add the corresponding JIRA info to the testCastToBoolean method, or you can add the corresponding comment here.


// Converting a variant to anything that does not match the runtime type returns null
f.checkScalar("cast(cast(1 as VARIANT) as INTEGER)", "1", "INTEGER");
Expand Down
Loading