matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Bug]: rpad & lpad different behavior

Open dengn 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

Related to #3255.

select rpad('hello', -18446744073709551615, '1'); rpad('hello', -18446744073709551615, '1') null select rpad('hello', 18446744073709551615, '1'); rpad('hello', 18446744073709551615, '1') null select rpad('hello', -18446744073709551616, '1'); rpad('hello', -18446744073709551616, '1') null select rpad('hello', 18446744073709551616, '1'); rpad('hello', 18446744073709551616, '1') null select rpad('hello', -18446744073709551617, '1'); rpad('hello', -18446744073709551617, '1') null select rpad('hello', 18446744073709551617, '1'); rpad('hello', 18446744073709551617, '1') null

select lpad('hello', -18446744073709551615, '1'); Operator 'cast' with parameters [DECIMAL128 BIGINT] will be implemented in future version. select lpad('hello', 18446744073709551615, '1'); Can't cast '18446744073709551615' from BIGINT UNSIGNED type to BIGINT type. Reason: overflow select lpad('hello', -18446744073709551616, '1'); Operator 'cast' with parameters [DECIMAL128 BIGINT] will be implemented in future version. select lpad('hello', 18446744073709551616, '1'); Operator 'cast' with parameters [DECIMAL128 BIGINT] will be implemented in future version. select lpad('hello', -18446744073709551617, '1'); Operator 'cast' with parameters [DECIMAL128 BIGINT] will be implemented in future version. select lpad('hello', 18446744073709551617, '1'); Operator 'cast' with parameters [DECIMAL128 BIGINT] will be implemented in future version

RPAD and LPAD with the same arguments show different behaviors.

Expected Behavior

select rpad('hello', -18446744073709551615, '1'); rpad('hello', -18446744073709551615, '1') null select rpad('hello', 18446744073709551615, '1'); rpad('hello', 18446744073709551615, '1') null select rpad('hello', -18446744073709551616, '1'); rpad('hello', -18446744073709551616, '1') null select rpad('hello', 18446744073709551616, '1'); rpad('hello', 18446744073709551616, '1') null select rpad('hello', -18446744073709551617, '1'); rpad('hello', -18446744073709551617, '1') null select rpad('hello', 18446744073709551617, '1'); rpad('hello', 18446744073709551617, '1') null

select lpad('hello', -18446744073709551615, '1'); null select lpad('hello', 18446744073709551615, '1'); null select lpad('hello', -18446744073709551616, '1'); null select lpad('hello', 18446744073709551616, '1'); null select lpad('hello', -18446744073709551617, '1'); null select lpad('hello', 18446744073709551617, '1'); null

Steps to Reproduce

No response

Additional information

No response

dengn avatar Jul 04 '22 14:07 dengn