TechWizard9999 opened a new issue, #405: URL: https://github.com/apache/datafusion-spark/issues/405
### Describe the bug `bit_get` panics for a `UInt64` value above `9223372036854775807`. The first argument accepts every integer type, including unsigned ones (`TypeSignatureClass::Integer`). The kernel converts the value with `value.to_i64().unwrap()` ([bit_get.rs#L126](https://github.com/apache/datafusion-spark/blob/d6d281904bc793d1f96eaa96cbbf5f2823146143/crates/spark/src/function/bitwise/bit_get.rs#L126)), which is `None` for a `UInt64` above `i64::MAX`. ### To Reproduce ```sql SELECT bit_get(arrow_cast('18446744073709551615', 'UInt64'), 0::int); ``` datafusion-spark returns: ``` panicked at crates\spark\src\function\bitwise\bit_get.rs:126:29: called `Option::unwrap()` on a `None` value ``` This panics in release builds too. `UInt64` values up to `9223372036854775807` work: `bit_get(arrow_cast('9223372036854775807', 'UInt64'), 0::int)` returns `1`. ### Expected behavior Spark has no unsigned types, so there is no Spark result to match. A `UInt64` can still come from Arrow or Parquet data. `bit_get` should return the bit (`1` here), or reject unsigned input at planning time. It should not panic. ### Spark versions Spark 4.0.0. `BitwiseGet` takes `IntegralType` (byte, short, int, long) ([bitwiseExpressions.scala#L276](https://github.com/apache/spark/blob/v4.0.0/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/bitwiseExpressions.scala#L276)). ### datafusion-spark version main at d6d2819 ### Additional context Found with the sqllogictest runner, in both simplify and evaluate modes. cc @andygrove -- 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]
