[Bug]: Aggregate function sum data type errors
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): 6dedae20180c9e7ad4159ef0c7ad0f8e8c358dee
- Hardware parameters: MAC M1 ARM 16GB
- OS type: OSX
- Others:
Actual Behavior
Function 'sum' with parameters [BOOL] will be implemented in future version. Operator '=' with parameters [VARCHAR DOUBLE] will be implemented in future version. Operator '=' with parameters [DECIMAL64 DOUBLE] will be implemented in future version. Function 'sum' with parameters [VARCHAR] will be implemented in future version.
[SQL STATEMENT]: select cast(sum( df) as signed) from t1; [EXPECT RESULT]: cast(sum( df) as signed) 3 [ACTUAL RESULT]: parameter types of cast function do not match
[SQL STATEMENT]: select cast(min(df) as signed) from t1; [EXPECT RESULT]: cast(min(df) as signed) 1 [ACTUAL RESULT]: parameter types of cast function do not match
Operator '*' with parameters [DOUBLE DECIMAL64] will be implemented in future version.
Expected Behavior
No response
Steps to Reproduce
No response
Additional information
No response
do not support,bool => float, decimal => bigint: Function 'sum' with parameters [BOOL] will be implemented in future version. Operator 'cast' with parameters [DECIMAL64 BIGINT] will be implemented in future version. Operator 'cast' with parameters [DECIMAL64 BIGINT] will be implemented in future version.
solved: Operator '=' with parameters [VARCHAR DOUBLE] will be implemented in future version. Operator '=' with parameters [DECIMAL64 DOUBLE] will be implemented in future version. Function 'sum' with parameters [VARCHAR] will be implemented in future version. Operator '*' with parameters [DOUBLE DECIMAL64] will be implemented in future version.
@m-schen says that the implicit conversion will not happen in the aggregation function.
mysql> create table t2 (ff double); Query OK, 0 rows affected (0.00 sec)
mysql> insert into t2 values (2.2); Query OK, 1 row affected (0.01 sec)
mysql> select cast(sum( ff) as decimal(5,2)) from t2; +--------------------------------+ | cast(sum(ff) as decimal(5, 2)) | +--------------------------------+ | 2.20 | +--------------------------------+ 1 row in set (0.00 sec)
mysql> select cast(sum( ff) as signed) from t2; +---------------------+ | cast(sum(ff) as ff) | +---------------------+ | 2 | +---------------------+ 1 row in set (0.00 sec)
mysql> select cast(variance(ff) as decimal(10,3)) from t2; +--------------------------------------+ | cast(variance(ff) as decimal(10, 3)) | +--------------------------------------+ | 0.000 | +--------------------------------------+ 1 row in set (0.00 sec)
mysql> select cast(min(ff) as decimal(5,2)) from t2; +--------------------------------+ | cast(min(ff) as decimal(5, 2)) | +--------------------------------+ | 2.20 | +--------------------------------+ 1 row in set (0.00 sec)
mysql> create table t1 (df decimal(5,1)); Query OK, 0 rows affected (0.01 sec)
mysql> insert into t1 values(1.1); Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(2.2); Query OK, 1 row affected (0.00 sec)
mysql> mysql> select cast(sum( df) as signed) from t1; +---------------------+ | cast(sum(df) as df) | +---------------------+ | 3 | +---------------------+ 1 row in set (0.00 sec)
mysql> select cast(min(df) as signed) from t1; +---------------------+ | cast(min(df) as df) | +---------------------+ | 1 | +---------------------+ 1 row in set (0.00 sec)
mysql> select 1e8 * sum( df) from t1; +---------------+ | 1e8 * sum(df) | +---------------+ | 330000000 | +---------------+ 1 row in set (0.01 sec)
mysql> select 1e8 * min(df) from t1; +--------------------+ | 1e8 * min(df) | +--------------------+ | 110000000.00000001 | +--------------------+ 1 row in set (0.00 sec)
mysql>