Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR_IF_OVERFLOW]If the computed number is a constant, the overflow still returns null #54235

Open
chengqianli-git opened this issue Dec 23, 2024 · 0 comments
Assignees
Labels
type/bug Something isn't working

Comments

@chengqianli-git
Copy link

Steps to reproduce the behavior (Required)

  1. CREATE TABLE '...'
  2. INSERT INTO '....'
  3. SELECT '....'`4.
mysql> show create table test_float;
+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table      | Create Table                                                                                                                                                                                                                                                                                                 |
+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_float | CREATE TABLE `test_float` (
  `a` int(11) NULL COMMENT "",
  `b` float NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`a`)
DISTRIBUTED BY RANDOM
PROPERTIES (
"bucket_size" = "4294967296",
"compression" = "LZ4",
"fast_schema_evolution" = "true",
"replicated_storage" = "true",
"replication_num" = "3"
); |
+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>

mysql> select /*+ SET_VAR(sql_mode='ERROR_IF_OVERFLOW')*/  cast(b * 2147483648 as decimal32(5,2)) from test_float;
ERROR 1064 (HY000): Expr evaluate meet error: The type cast from other types to decimal overflows: BE:10003
mysql>
mysql> select /*+ SET_VAR(sql_mode='ERROR_IF_OVERFLOW')*/  cast(1.234 * 2147483648 as decimal32(5,2)) from test_float;

Expected behavior (Required)

response error info

Real behavior (Required)

mysql> select /*+ SET_VAR(sql_mode='ERROR_IF_OVERFLOW')*/  cast(1.234 * 2147483648 as decimal32(5,2)) from test_float;
+----------------------------------------------+
| CAST((1.234 * 2147483648) AS DECIMAL32(5,2)) |
+----------------------------------------------+
|                                         NULL |
+----------------------------------------------+

StarRocks version (Required)

  • You can get the StarRocks version by executing SQL select current_version()
@chengqianli-git chengqianli-git added the type/bug Something isn't working label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants