cloud-fan commented on a change in pull request #26139: [SPARK-29491][SQL] Add bit_count function support URL: https://github.com/apache/spark/pull/26139#discussion_r335811148
########## File path: sql/core/src/test/resources/sql-tests/inputs/bitwise.sql ########## @@ -0,0 +1,44 @@ +-- test cases for bitwise functions + +-- null + +select bit_count(null); + +-- boolean +select bit_count(true); +select bit_count(false); + +-- byte/tinyint +select bit_count(cast(1 as tinyint)); +select bit_count(cast(2 as tinyint)); +select bit_count(cast(3 as tinyint)); + +-- short/smallint +select bit_count(1S); +select bit_count(2S); +select bit_count(3S); + +-- int +select bit_count(1); +select bit_count(2); +select bit_count(3); + +-- long/bigint +select bit_count(1L); +select bit_count(2L); +select bit_count(3L); + +-- negative num +select bit_count(-1L); + +-- mysql> select 9223372036854775807 + 1; +-- ERROR 1690 (22003): BIGINT value is out of range in '(9223372036854775807 + 1)' +-- mysql> select bit_count(9223372036854775807 + 1); +-- ERROR 1690 (22003): BIGINT value is out of range in '(9223372036854775807 + 1)' +-- out of range +select 9223372036854775807L + 1L; +select bit_count(9223372036854775807L + 1L); Review comment: we can test the min long value if that's what you intend to do here. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
