matrixone
matrixone copied to clipboard
[Bug]: can't cast XXXX from YYYY type to ZZZZ type.
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Environment
- Version or commit-id (e.g. v0.1.0 or 8b23a93):9589f9ac950564ca34bccc79393775f09e59ed11
- Hardware parameters:
- OS type:
- Others:
Actual Behavior
can't cast 'ABC' from VARCHAR type to TINYINT UNSIGNED type. can't cast '你好' from VARCHAR type to TINYINT UNSIGNED type.
[ERROR] [SCRIPT FILE]: /Users/pengzhen/Documents/GitHub/matrixone/test/cases/function/func_string_oct.test [ROW NUMBER]: 59 [SQL STATEMENT]: SELECT distinct oct(a), oct(b) FROM t1 ORDER BY oct(a); [EXPECT RESULT]: oct(a) oct(b) 106 540 220 540 [ACTUAL RESULT]: can't cast column from VARCHAR type to TINYINT UNSIGNED type because of one or more values in that column.
can't cast '' from VARCHAR type to BIGINT type.
[ERROR] [SCRIPT FILE]: /Users/pengzhen/Documents/GitHub/matrixone/test/cases/function/func_string_lpad_rpad.test [ROW NUMBER]: 99 [SQL STATEMENT]: SELECT ((+0) IN ((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), (32767.1))); [EXPECT RESULT]: ((+0) IN ((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), (32767.1))) 0 [ACTUAL RESULT]: can't cast '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' from VARCHAR type to BIGINT type.
CREATE TABLE t1 (f1 double); INSERT INTO t1 SET f1 = -1.0e+30 ; INSERT INTO t1 SET f1 = +1.0e+30 ; SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
can't cast column from DOUBLE type to BIGINT type because of one or more values in that column. Reason: overflow
Expected Behavior
Steps to Reproduce
No response
Additional information
No response
-- Not a problem. My clients' problem. -- Ignore Please. my:[email protected]:6001/foo=> select substring('', 1, ''); (0 rows)

CREATE TABLE t1 (f1 double); INSERT INTO t1 SET f1 = -1.0e+30 ; INSERT INTO t1 SET f1 = +1.0e+30 ; SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1; can't cast column from DOUBLE type to BIGINT type because of one or more values in that column. Reason: overflow
@daviszhen What does this expectation look like?
@daviszhen The owner of an issue can close issue.
simplest cases to reproduce:
MySQL [mo]> SELECT cast('1.1' as signed int); ERROR 20203 (HY000): invalid argument cast to int, bad value 1.1 MySQL [mo]> MySQL [mo]> SELECT cast(1e30 as signed int); ERROR 20201 (HY000): data out of range: data type int64, value '1e+30'
for this error, keep this unchanged. confirmed with @domingozhang MySQL [mo]> SELECT cast(1e30 as signed int); ERROR 20201 (HY000): data out of range: data type int64, value '1e+30'
the range can be stayed
these errors still keep unchanged. confirmed with @domingozhang
MySQL [mo]> SELECT cast('1.1' as int);
ERROR 20203 (HY000): invalid argument cast to int, bad value 1.1
MySQL [mo]>
MySQL [mo]> SELECT cast('.1' as int);
ERROR 20203 (HY000): invalid argument cast to int, bad value .1
MySQL [mo]> SELECT cast('' as int);
ERROR 20203 (HY000): invalid argument cast to int, bad value
MySQL [mo]>
MySQL [mo]> SELECT cast(' ' as int);
ERROR 20203 (HY000): invalid argument cast to int, bad value
MySQL [mo]>
MySQL [mo]> SELECT cast('jj' as int);
ERROR 20203 (HY000): invalid argument cast to int, bad value jj