UDF: Scalar UDF returns strange warnings when handling SQLUDR_DOUBLE
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trafodion |
In Progress
|
High
|
Suresh Subbiah |
Bug Description
In the following example, the UDF is implemented to take one SQLUDR_DOUBLE input and return the same value as the SQLUDR_DOUBLE output:
SQLUDR_LIBFUNC SQLUDR_DOUBLE qa_func_double (
SQLUDR_DOUBLE *in,
SQLUDR_DOUBLE *out,
SQLUDR_INT16 *inInd,
SQLUDR_INT16 *outInd,
SQLUDR_
{
if (calltype == SQLUDR_
return SQLUDR_SUCCESS;
if (SQLUDR_
SQLUDR_
else
*out = *in;
return SQLUDR_SUCCESS;
}
At the execution time, 2 functions are defined to map to this UDF implementation with 2 different data types: FLOAT and DOUBLE PRECISION respectively. The results were returned properly, but a strange 11250 warning was returned as well:
*** WARNING[11250] User-defined function TRAFODION.
*** WARNING[11250] User-defined function TRAFODION.
This is seen on the v0331 build installed on a workstation. To reproduce it:
(1) Download the attached tar file and untar it to get the 3 files in there. Put the files in any directory <mydir>.
(2) Make sure that you have run ./sqenv.sh of your Trafodion instance first as building UDF needs $MY_SQROOT for the header files.
(3) run build.sh
(4) Change the line “create library qa_udf_lib file '<mydir>
(5) From sqlci, obey mytest.sql
-------
Here is the execution output:
>>create schema mytest;
--- SQL operation complete.
>>set schema mytest;
--- SQL operation complete.
>>
>>create library qa_udf_lib file '<mydir>/myudf.so';
--- SQL operation complete.
>>
>>create function qa_udf_float
+>(INVAL float(10))
+>returns (OUTVAL float(10))
+>language c
+>parameter style sql
+>external name 'qa_func_double'
+>library qa_udf_lib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>create function qa_udf_
+>(INVAL double precision)
+>returns (OUTVAL double precision)
+>language c
+>parameter style sql
+>external name 'qa_func_double'
+>library qa_udf_lib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>create table mytable1 (c float);
--- SQL operation complete.
>>insert into mytable1 values (1.1);
--- 1 row(s) inserted.
>>select qa_udf_float(c) from mytable1;
*** WARNING[11250] User-defined function TRAFODION.
OUTVAL
-------
1.100000000000
*** WARNING[11250] User-defined function TRAFODION.
--- 1 row(s) selected.
>>
>>create table mytable2 (c double precision);
--- SQL operation complete.
>>insert into mytable2 values (2.2);
--- 1 row(s) inserted.
>>select qa_udf_
*** WARNING[11250] User-defined function TRAFODION.
OUTVAL
-------
2.200000000000
*** WARNING[11250] User-defined function TRAFODION.
--- 1 row(s) selected.
>>
>>drop function qa_udf_float cascade;
--- SQL operation complete.
>>drop function qa_udf_
--- SQL operation complete.
>>drop library qa_udf_lib cascade;
--- SQL operation complete.
>>
>>drop schema mytest cascade;
--- SQL operation complete.
Changed in trafodion: | |
assignee: | nobody → Hans Zeller (hans-zeller) |
assignee: | Hans Zeller (hans-zeller) → nobody |
Changed in trafodion: | |
assignee: | nobody → Suresh Subbiah (suresh-subbiah) |
milestone: | r1.1 → r1.2 |
Changed in trafodion: | |
status: | New → In Progress |