29 Nov
2012
29 Nov
'12
3:13 p.m.
I'm having the same problem, for an aggregate function: > TypeException:user.s1_1[38]:'batudf.hllagg' undefined in: _51:bat[:any,:str] := batudf.hllagg(_48:bat[:oid,:str], _22:bat[:oid,:oid], _23:bat[:oid,:oid]) Heres the defs, taken from xml example: /* ******** */ module batudf; command hllagg(val:bat[:oid,:str],grp:bat[:oid,:oid]):bat[:oid,:str] address BATHLLagg comment "Aggregate the HLL values over groups specified."; command hllagg(val:bat[:oid,:str]):str address BATHLLgroup comment "Aggregate the HLL values over groups specified."; /* ******** */ I can't seem to spot where's the error. I have some doubts though: - the examples have a 'udf' module and a 'batudf' module. I'm guessing its impls for scalar and BATs. Aggregate functions don't need scalar impls right? - how does the .mal types map to sql types? it seems that I'm returning a CLOB, but I can't spot where the return type is being defined. There's some sort of automatic typecasting going on? - I mostly copied the xml agg and group C impls, and am trying to understand them. It seems there's alot of macros and fn calls to prepare data for reading, but the actual work impl is quite small. I don't understand these lines though: > if (buf[0] == 'A') n = snprintf(buf + offset, size - offset, " %s", t + 1); (...) this makes sense for a general group function? It seems that it has to do with xml types in particular.. Thanks again, Miguel On 11/29/2012 01:52 PM, Niels Nes wrote: > On Thu, Nov 29, 2012 at 04:20:09PM +0530, swapnil joshi wrote: >> Hi, >> >> i am trying to define user define function which has argument integer >> bat and returning integer. >> >> step 1: >> >> i have added function defination in udf_80.sql as follow >> >> create function xtest(one integer) >> returns integer external name udf.xtest; >> >> step 2: >> i have added function defination in udf.mal >> >> module udf; > Scalar function requires single value argument. > ie not >> command xtest(b:bat[:oid,:int]):int > but > command xtest(b:int):int > > Niels >> address UDFBATxtest >> comment "function xtest"; >> module batudf; >> command xtest(b:bat[:oid,:int]):int >> address UDFBATxtest >> comment "function xtest"; >> >> step 3: >> then i have define this function in udf.c file >> UDFBATxtest_(int *ret, BAT *src) >> { >> >> return MAL_SUCCEED; >> } >> >> str >> UDFBATxtest(int *ires, bat *ione) >> { >> BAT *bone = NULL; >> str msg = NULL; >> /* assert calling sanity */ >> assert(ione != NULL); >> >> /* bat-id -> BAT-descriptor */ >> if ((bone = BATdescriptor(*ione)) == NULL) >> throw(MAL, "batudf.xtest", RUNTIME_OBJECT_MISSING); >> >> /* do the work */ >> msg = UDFBATxtest_ ( ires, bone); >> >> return msg; >> } >> >> step 4: >> then i have compiled source code and installed it: >> >> step 5: >> i am try to execute xtest function on mclient but i got following >> error >> sql>select xtest(id) from student; >> TypeException:user.s23_1[16]:'udf.xtest' undefined in: _53:any := >> udf.xtest(_51:int) >> TypeException:user.s23_1[17]:'bat.insert' undefined in: _54:any := >> bat.insert(_45:bat[:oid,:int], _50:oid, _53:any) >> program contains errors >> >> step 6: >> write a mail and sent to you for getting help i hope you will give me. >> >> >> -- >> Regards, >> Swapnil K. Joshi >> >> _______________________________________________ >> users-list mailing list >> users-list@monetdb.org >> http://mail.monetdb.org/mailman/listinfo/users-list > _______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list