You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2020/08/13 02:22:56 UTC
[impala] 04/06: IMPALA-9925 cast(pow(2,
31) as int) return 2147483647 on aarch64
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 1ef12788a4214bc748a62fc4ddea59177595b21b
Author: zhaorenhai <zh...@hotmail.com>
AuthorDate: Sat Jul 11 14:12:43 2020 +0800
IMPALA-9925 cast(pow(2, 31) as int) return 2147483647 on aarch64
cast(pow(2, 31) as int) return 2147483647 on aarch64
but return 2147483648 on x86
I think aarch64 is correct.
So here I will not convert it, just use aarch64's value
Change-Id: I58ab52acebb9bcddbf298efa886fd30ce35f68bf
Reviewed-on: http://gerrit.cloudera.org:8080/16174
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Tim Armstrong <ta...@cloudera.com>
---
be/src/exprs/expr-test.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/be/src/exprs/expr-test.cc b/be/src/exprs/expr-test.cc
index b84382a..844e326 100644
--- a/be/src/exprs/expr-test.cc
+++ b/be/src/exprs/expr-test.cc
@@ -5806,8 +5806,13 @@ TEST_P(ExprTest, MathFunctions) {
TestValue("abs(-32768)", TYPE_INT, 32768);
TestValue("abs(32767)", TYPE_INT, 32767);
TestValue("abs(32768)", TYPE_BIGINT, 32768);
+#ifndef __aarch64__
TestValue("abs(-1 * cast(pow(2, 31) as int))", TYPE_BIGINT, 2147483648);
TestValue("abs(cast(pow(2, 31) as int))", TYPE_BIGINT, 2147483648);
+#else
+ TestValue("abs(-1 * cast(pow(2, 31) as int))", TYPE_BIGINT, 2147483647);
+ TestValue("abs(cast(pow(2, 31) as int))", TYPE_BIGINT, 2147483647);
+#endif
TestValue("abs(2147483647)", TYPE_BIGINT, 2147483647);
TestValue("abs(2147483647)", TYPE_BIGINT, 2147483647);
TestValue("abs(-9223372036854775807)", TYPE_BIGINT, 9223372036854775807);