matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Bug]: LEFT(str, len) occurs type transfer error between String and INT

Open goodMan-code opened this issue 3 years ago • 0 comments

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):
- Hardware parameters:
- OS type:
- Others:

Actual Behavior

Table Structure : DROP TABLE IF EXISTS t; CREATE TABLE t( id INT, str1 VARCHAR(20), str2 CHAR(20), PRIMARY KEY (id) );

DML : INSERT INTO t VALUES (123456, '[email protected]', 'googood'), (123457, '[email protected]','hainghing');

SELECT * FROM t;

The problematic SQL stmt is : SELECT LEFT(id, '1'+2), LEFT(str1, '1'+'1'), LEFT(str2, '1'+'0') FROM t;

It's result : +-----------------+-------------------+-------------------+ | left(id, 1 + 2) | left(str1, 1 + 1) | left(str2, 1 + 0) | +-----------------+-------------------+-------------------+ | 123 | anike1001@g | googood | | 123 | nitin5438@y | hainghing | +-----------------+-------------------+-------------------+

The Question is : '1' + 2 = 3, '1' + '1' = 11.

Expected Behavior

No response

Steps to Reproduce

No response

Additional information

No response

goodMan-code avatar Oct 10 '22 09:10 goodMan-code