From: | Chengjie Qin <qinchengjie(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Initialize the User-defined Aggregate in ECPG |
Date: | 2012-03-20 16:48:16 |
Message-ID: | CAPjrMRmZx0nuJCAJmS5AmZObka27ir=ZTxbhZ0Hm+Lw7nEkdFA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
I'm using the embedded SQL in C to create the User-Defined Aggregate(UDA).
The command is :
CREATE AGGREGATE aggname( sfunc=kmeans,
stype=double precision[],
finalfunc=kmeansfinal,
INITCOND='{1,2,3}');
Since I need to do the aggregation in multiple rounds. I need to initialize
the INITCOND using the execution result of last execution (aggregation.)
Any one can tell me how can I initialize the INITCOND using host variables
instead of hard code the INITCOND?
The reason why I need to do this is that I am implementing the K-Means
Clustering
algorithm which is a recursive algorithm. Now my idea of doing this is I
get the result from
one round aggregation, DROP the AGGREGATE, and CREATE a new AGGREGATE
using the result of last round.
Jay
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Colson | 2012-03-20 16:59:26 | Re: Is it even possible? |
Previous Message | Josh Kupershmidt | 2012-03-20 15:55:56 | Re: PASSWORD vs. md5('somepass') |