[MCOL-4247] SUM() and AVG() in subquery return zero. Created: 2020-08-13  Updated: 2020-11-12  Resolved: 2020-08-20

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: 1.0.0
Fix Version/s: 5.4.1

Type: Bug Priority: Major
Reporter: susil.behera Assignee: susil.behera
Resolution: Fixed Votes: 0
Labels: None

Sprint: 2020-8

 Description   

Build tested: 1.5.4-1 (Drone build #417)

CREATE TABLE t2(c INT)ENGINE=Columnstore;
INSERT INTO t2 VALUES (1), (2);
SELECT SUM(c) FROM t2;
--------

SUM(c)

--------

3

--------
1 row in set (0.075 sec)

SELECT (SELECT SUM(c) FROM t2) FROM t2;
-------------------------

(SELECT SUM(c) FROM t2)

-------------------------

0
0

-------------------------
2 rows in set, 2 warnings (0.044 sec)

SELECT (SELECT AVG(c) FROM t2) FROM t2;
-------------------------

(SELECT AVG(c) FROM t2)

-------------------------

0
0

-------------------------
2 rows in set, 2 warnings (0.023 sec)

SHOW WARNINGS;
--------------------------------------------------------------------

Level Code Message

--------------------------------------------------------------------

Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1918 Encountered illegal value '' when converting to DECIMAL

--------------------------------------------------------------------
2 rows in set (0.000 sec)

Expected result:
SELECT (SELECT SUM(c) FROM t2) FROM t2;
-------------------------

(SELECT SUM(c) FROM t2)

-------------------------

3
3

-------------------------
2 rows in set (0.026 sec)

SELECT (SELECT AVG(c) FROM t2) FROM t2;
-------------------------

(SELECT AVG(c) FROM t2)

-------------------------

1.5000
1.5000

-------------------------
2 rows in set (0.026 sec)

This is a regression as it used to return the correct result in Drone build #411 and before.



 Comments   
Comment by David Hall (Inactive) [ 2020-08-17 ]

Since #411 and #417 are from the same Columnstore hash, I assumed it's caused by a change in the server. This has been confirmed.

Comment by David Hall (Inactive) [ 2020-08-17 ]

Something in compiler settings or the new use of "override" and "final" in function declarations made it use a different virtual function during a callback. Our code probably could have been better, so fixing that.

Comment by susil.behera [ 2020-08-20 ]

Verified on,
Server version: 10.5.6
MCS version: 1.5.4-1 (Drone build #441)

Generated at Thu Feb 08 02:48:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.