spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] yaooqinn commented on a change in pull request #26139: [SPARK-29491][SQL] Add bit_count function support
Date Thu, 17 Oct 2019 06:35:22 GMT
yaooqinn 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_r335829451
 
 

 ##########
 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;
 
 Review comment:
   ok, I will rm these and just check long min/max

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message