[MDEV-31644] Unable to use ROUND() on aggregate functions on a Spider table Created: 2023-07-07  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.5.11, 10.4, 10.5.19, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0

Type: Bug Priority: Major
Reporter: Rob G Assignee: Yuchen Pei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows x64


Attachments: File SpiderRound.sql    

 Description   

Attached SQL to recreate issue.



 Comments   
Comment by Alice Sherepa [ 2023-07-19 ]

Thanks! repeated on 10.4-10.11:

set password for 'root'@localhost='';
install soname "ha_spider";
 
create database spidertesta;
 
create table spidertesta.testtable ( testnum bigint(20) not null, readvalue bigint(20) default 0, primary key (testnum)) engine=myisam;
create server localspider foreign data wrapper mysql options( host '127.0.0.1', database 'spidertesta',user 'root', password '',port 16000 );
 
create database spidertestb;
set @@spider_same_server_link=1;
 
create table spidertestb.testtable ( testnum bigint(20) not null, readvalue bigint(20) default 0, primary key (testnum)) engine=spider comment='srv "localspider"';
 
select round(sum(readvalue)+0,2) from spidertestb.testtable;
select round(sum(readvalue),2) from spidertestb.testtable;

also not working with window functions

MariaDB [test]> insert into spidertesta.testtable select seq,seq from seq_1_to_10;
Query OK, 10 rows affected (0.001 sec)
Records: 10  Duplicates: 0  Warnings: 0
 
MariaDB [test]> select round(sum(readvalue)+0,2) from spidertestb.testtable;
+---------------------------+
| round(sum(readvalue)+0,2) |
+---------------------------+
|                     55.00 |
+---------------------------+
1 row in set (0.003 sec)
 
MariaDB [test]> select round(sum(readvalue),2) from spidertestb.testtable;
ERROR 1054 (42S22): Unknown column 'sum(readvalue)' in 'field list'
 
MariaDB [test]> select sum(readvalue) over () from spidertestb.testtable;
ERROR 1054 (42S22): Unknown column 'spidertestb.testtable.readvalue' in 'field list'
MariaDB [test]> select rank() over (order by readvalue) from spidertestb.testtable;
ERROR 1054 (42S22): Unknown column 'spidertestb.testtable.readvalue' in 'order clause'
 
MariaDB [test]> select rank() over (order by 1) from spidertestb.testtable;
+--------------------------+
| rank() over (order by 1) |
+--------------------------+
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
|                     NULL |
+--------------------------+
10 rows in set (0.003 sec)

Generated at Thu Feb 08 10:25:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.