Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.0(EOL), 10.1(EOL), 10.2(EOL)
-
None
Description
Explicit cast from string to DOUBLE and DECIMAL understands scientific number notation.
Explicit cast from string to SIGNED and UNSIGNED does not understand.
SELECT CAST('1.9e19' AS DOUBLE) AS c1, |
CAST('1.9e19' AS DECIMAL(30,1)) AS c2, |
CAST('1.9e19' AS SIGNED) AS c3, |
CAST('1.9e19' AS UNSIGNED) AS c4; |
+--------+------------------------+----+----+
|
| c1 | c2 | c3 | c4 |
|
+--------+------------------------+----+----+
|
| 1.9e19 | 19000000000000000000.0 | 1 | 1 |
|
+--------+------------------------+----+----+
|
SELECT COLUMN_GET(COLUMN_CREATE(0, '1.9e19'), 0 AS DOUBLE) AS c1, |
COLUMN_GET(COLUMN_CREATE(0, '1.9e19'), 0 AS DECIMAL(30,1)) AS c2, |
COLUMN_GET(COLUMN_CREATE(0, '1.9e19'), 0 AS SIGNED) AS c3, |
COLUMN_GET(COLUMN_CREATE(0, '1.9e19'), 0 AS UNSIGNED) AS c4; |
+--------+------------------------+------+------+
|
| c1 | c2 | c3 | c4 |
|
+--------+------------------------+------+------+
|
| 1.9e19 | 19000000000000000000.0 | 1 | 1 |
|
+--------+------------------------+------+------+
|
Note, implicit cast in INSERT understands scientific notation:
CREATE OR REPLACE TABLE t1 (a BIGINT); |
INSERT INTO t1 VALUES ('1.9e19'); |
SELECT * FROM t1; |
+---------------------+
|
| a |
|
+---------------------+
|
| 9223372036854775807 |
|
+---------------------+
|
Explicit CAST to SIGNED/UNSIGNED should be fixed to understand scientific notation.