Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KDB: user-defined aggregation function on tables

Tags:

aggregate

kdb+

Consider a simple user-defined aggregation function MySum:{sum x}, and consider the table

data:([]y:1 8 27 64 125;x1:1 2 3 4 5;x2:1 4 9 16 25).  

Why does the following not work?

select MySum{x}x2 from data
`rank
like image 266
bigO6377 Avatar asked Dec 28 '25 10:12

bigO6377


1 Answers

You can use :

 q)select enlist MySum x2 from data

Why 'select Mysum x2 from data' doesn't work?

From KDB WIKI: "The following functions receive special treatment within select

count,first,last,sum,prd,min,max,med,avg,wsum,wavg,var,dev,cov,cor "

For Details, read: http://code.kx.com/q/ref/qsql/#select

Section: Special functions within select

like image 66
Rahul Avatar answered Dec 31 '25 14:12

Rahul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!