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; command xtest(b:bat[:oid,:int]):int 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
Check the logs, I had the exact same error. log file should be at dbpath/merovingian.log My problem was indeed an error with my code. On 11/29/2012 10:50 AM, 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; command xtest(b:bat[:oid,:int]):int 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
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
-- Niels Nes, Centrum Wiskunde & Informatica (CWI) Science Park 123, 1098 XG Amsterdam, The Netherlands room L3.14, phone ++31 20 592-4098 sip:4098@sip.cwi.nl url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl _______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
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
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
On Thu, Nov 29, 2012 at 02:13:46PM +0000, Miguel Ping wrote:
I'm having the same problem, for an aggregate function:
On which version of monetdb?
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]
The sql interface needs the 3 argument version (as can be seen from the error) So you need to implement the 3 argument version, ie val, grp and extend. Niels
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
-- Niels Nes, Centrum Wiskunde & Informatica (CWI) Science Park 123, 1098 XG Amsterdam, The Netherlands room L3.14, phone ++31 20 592-4098 sip:4098@sip.cwi.nl url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl _______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
monetdb --version MonetDB Database Server Toolkit v1.0 (Oct2012-SP1)
I've implemented the third function; monetdb now complains about incompatible types, I'm guessing that it has to do with the src internals, specifically this:
err = "incompatible values in group";
I'm guessing that the "real" work of the aggregate fns is inside the loop, is there any docs on the src api? I'm having trouble with this specific part: (...) if (offset == 0) n = snprintf(buf, size, "%s", t); else if (buf[0] != *t) { err = "incompatible values in group"; //<<<<<< this err? goto bunins_failed; } else if (buf[0] == 'A') n = snprintf(buf + offset, size - offset, " %s", t + 1); else if (buf[0] == 'C') n = snprintf(buf + offset, size - offset, "%s", t + 1); else { err = "can only group attributes and element content"; goto bunins_failed; } (...) On 11/29/2012 03:51 PM, Niels Nes wrote:
On Thu, Nov 29, 2012 at 02:13:46PM +0000, Miguel Ping wrote:
I'm having the same problem, for an aggregate function: On which version of monetdb?
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] The sql interface needs the 3 argument version (as can be seen from the error) So you need to implement the 3 argument version, ie val, grp and extend.
Niels
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
_______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
On Thu, Nov 29, 2012 at 04:33:25PM +0000, Miguel Ping wrote:
monetdb --version MonetDB Database Server Toolkit v1.0 (Oct2012-SP1)
I've implemented the third function; monetdb now complains about incompatible types, I'm guessing that it has to do with the src internals, specifically this:
err = "incompatible values in group";
I'm guessing that the "real" work of the aggregate fns is inside the loop, is there any docs on the src api? I'm having trouble with this specific part:
(...)
if (offset == 0) n = snprintf(buf, size, "%s", t); else if (buf[0] != *t) { err = "incompatible values in group"; //<<<<<< this err?
goto bunins_failed; } else if (buf[0] == 'A') n = snprintf(buf + offset, size - offset, " %s", t + 1); else if (buf[0] == 'C') n = snprintf(buf + offset, size - offset, "%s", t + 1); else { err = "can only group attributes and element content"; goto bunins_failed; }
These are very specific error messages to the xmlagg function. On error the function should return this. On success it return MAL_SUCCEED (aka NULL). Niels
(...)
On 11/29/2012 03:51 PM, Niels Nes wrote:
On Thu, Nov 29, 2012 at 02:13:46PM +0000, Miguel Ping wrote:
I'm having the same problem, for an aggregate function: On which version of monetdb?
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] The sql interface needs the 3 argument version (as can be seen from the error) So you need to implement the 3 argument version, ie val, grp and extend.
Niels
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
_______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
-- Niels Nes, Centrum Wiskunde & Informatica (CWI) Science Park 123, 1098 XG Amsterdam, The Netherlands room L3.14, phone ++31 20 592-4098 sip:4098@sip.cwi.nl url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl _______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
participants (3)
-
Miguel Ping -
Niels Nes -
swapnil joshi