Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R aggregate not recognized when using 3 or more parameters #3929

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

R aggregate not recognized when using 3 or more parameters #3929

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug normal SQL

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2016-02-23 16:13:11 +0100
From: tim.brown
To: SQL devs <>
Version: 11.21.13 (Jul2015-SP2)
CC: @njnes, tim.brown

Last updated: 2016-04-11 11:16:12 +0200

Comment 21816

Date: 2016-02-23 16:13:11 +0100
From: tim.brown

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Build Identifier:

Creating an embedded R aggregate with 3 or more parameters succeeds, but the aggregate is then not recognized in SELECT queries. Error message:

Error: SELECT: no such operator 'r_sw'
SQLState: 22000
ErrorCode: 0

In my example, I am trying to create a sliding window sum

Reproducible: Always

Steps to Reproduce:

CREATE AGGREGATE r_sw(val double, part varchar(255), endtime timestamp, starttime timestamp) RETURNS double LANGUAGE R {
library(data.table)
library(zoo)
DT=data.table(ag=aggr_group,pa=part,va=val,et=endtime,st=starttime)
setorder(DT,pa,et)
DT[, o:=mapply(function(x,y) DT[(et>=x & pa==y),.N], DT$st, DT$pa)]
as.data.frame(DT[,.(s:=rollapply(va,o,sum), by=pa)]$s)
};

SELECT id, mygroup, r_sw(myval,mygroup,myend,mystart) from mytable group by id, mygroup

Actual Results:

Error: SELECT: no such operator 'r_sw'
SQLState: 22000
ErrorCode: 0

Expected Results:

Any resultset.

Comment 21992

Date: 2016-03-30 13:53:39 +0200
From: @njnes

for 3 and more arguments general aggregates weren't handled at all. This is fixed, now an error in the R code or R binding is coming up.

Comment 22027

Date: 2016-04-11 11:16:12 +0200
From: @sjoerdmullender

Jul2015-SP4 has been released.

@monetdb-team monetdb-team added bug normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants