[MCOL-1981] regr_avgx and regr_avgy should return NULL if count is zero Created: 2018-11-29  Updated: 2019-02-08  Resolved: 2019-02-08

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: 1.2.1
Fix Version/s: 1.2.3

Type: Bug Priority: Minor
Reporter: David Hall (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Sprint: 2018-21, 2019-01

 Description   

Our implementations of regr_avgx and regr_avgy explicitly return 0 if there are no numbers to avg. This can happen if all rows contain NULL or if the Window Frame is fully outside the data being considered.

PostgreSQL and Snowflake both return NULL in these cases.



 Comments   
Comment by Daniel Lee (Inactive) [ 2019-02-08 ]

Build verified: 1.2.3-1 from buildbot nightly

server commit:
61f32f2
engine commit:
46cc344

Reproduced the issue in 1.2.1-1 and verified fixed in 1.2.3-1

Updated o_custkey and o_orderkey to NULL on a 1mb dbt3 database and execute:

select o_custkey, regr_avgy(o_custkey,o_orderkey) OVER (PARTITION BY abs(o_custkey)+2 ORDER BY o_custkey ,o_orderkey ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) from orders order by 1, 2;

also for regr_avgx

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