Omega359 commented on PR #15341:
URL: https://github.com/apache/datafusion/pull/15341#issuecomment-2745343678
> However, I am struggling to understand the implications of this change to
a user. Like for example, if we were going to add a note about this in the
upgrade / release notes, what would it say?
An issue was fixed where type coercion between expressions using certain
mathematical operations having unsigned / signed types could produce values
with an incorrect type that is not large enough to encompass all the possible
values for both types. For example, comparing an unsigned int32 with a signed
int32 could result in values having int32 type (where it should be int64) and
could result in "Can't cast .." error for any unsigned values larger than the
maximum int32 value.
This change may result in expressions unexpectedly having a 'larger' output
type than they would have had in previous releases.
> Or put another way, what problem is this PR solving (the ticket just
describes what the code does as wrong but it doesn't say why) 🤔
```Rust
let df = df
.select_columns(&[P_ID, IDENTITY_KEY_VALUE])?
.with_column(
IDENTITY_KEY_VALUE,
cast(hex_to_u64.call(vec![col(IDENTITY_KEY_VALUE)]),
DataType::UInt64),
)?
.with_column(PARTITION_COLUMN,
col(IDENTITY_KEY_VALUE).rem(lit(64)))?;
```
That currently throws `
Cast error: Can't cast value 16858640775341098663 to type Int32`
Is it easy to work around? Yes. Should it happen? No.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]