andygrove commented on code in PR #415:
URL: https://github.com/apache/datafusion-spark/pull/415#discussion_r4711203484


##########
crates/sqllogictest/test_files/bitwise/bit_get.slt:
##########
@@ -85,3 +85,9 @@ query I
 SELECT bit_get(11, 3::bigint);
 ----
 1
+
+# UInt64 values above i64::MAX return the bit instead of panicking
+query I
+SELECT bit_get(arrow_cast('18446744073709551615', 'UInt64'), 0);
+----
+1

Review Comment:
   Bit 0 shows the panic is gone, but it is also the bit the old code would 
have read correctly. Could you add an array-input query that reads bit 63 of a 
value above `i64::MAX`, and the pos 64 error for `UInt64`? For example:
   
   ```
   query II
   SELECT v, bit_get(v, p) FROM (VALUES (arrow_cast('18446744073709551615', 
'UInt64'), 63), (arrow_cast('9223372036854775808', 'UInt64'), 63), 
(arrow_cast('9223372036854775808', 'UInt64'), 62), (NULL, 1)) t(v, p);
   ----
   18446744073709551615 1
   9223372036854775808 1
   9223372036854775808 0
   NULL NULL
   
   query error bit_get: position 64 is out of bounds
   SELECT bit_get(arrow_cast('18446744073709551615', 'UInt64'), 64);
   ```
   
   Both pass on this branch. They pin the high-bit result on the array path and 
show the bounds check still applies to the new kernel.



-- 
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]

Reply via email to