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

It's impossible to handle a constant parameter in an aggregate function #7408

Open
msiomkin opened this issue Oct 25, 2023 · 1 comment
Open

Comments

@msiomkin
Copy link

msiomkin commented Oct 25, 2023

It's impossible to handle a constant parameter in an aggregate function. I hope it's a bug, not the by design behaviour. (E.g. say, I want to evaluate a truncated mean and need to pass the upper and lower bounds as constants).

To Reproduce

Create an aggregate using the attached source file.

Execute the following statements:

create table test(id int, value int);
insert into test(id, value) values(1, 1);
select myagg(id, 1) from test group by value;

Expected behavior

+-------------------------------------------------------------------------------------------+
| %1                                                                                        |
+===========================================================================================+
| 00010203                                                                                  |
+-------------------------------------------------------------------------------------------+

Actual behavior

TypeException:user.main[15]:'aggr.submyagg' undefined in:     X_0:bat[:blob] := aggr.submyagg(X_1:bat[:int], X_2:bat[:int], X_3:bat[:oid], X_4:bat[:oid], true:bit);

So I have to do some workaround: accept the second parameter as bat*, create an iterator for it and do BUNtail(it, 0). I think it's nor graceful neither very efficient.

And it does work for the ungrouped case, but I can't get the proper parameter value. It looks like there is some random number there.

select myagg(id, 1) from test;

Expected behavior (in merovingian.log)

#DFLOWworker1019: myagg: ERROR: COL2: 1

Actual behavior (in merovingian.log)

#DFLOWworker1019: myagg: ERROR: COL2: 1298

Software versions

  • MonetDB v11.47.3 (hg id: 79dbf838f044 88683)
  • Almalinux 8
  • self-installed and compiled
@njnes
Copy link
Contributor

njnes commented Oct 25, 2023

For now only for qantile* we allow a second (const) argument. See the code in is_const_func (rel_bin.c). Should be generalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants