UDF: Scalar UDF returns strange warnings when handling SQLUDR_DOUBLE

Bug #1439376 reported by Weishiun Tsai on 2015-04-01
6
This bug affects 1 person
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_TRAIL_ARGS)
{
  if (calltype == SQLUDR_CALLTYPE_FINAL)
    return SQLUDR_SUCCESS;

  if (SQLUDR_GETNULLIND(inInd) == SQLUDR_NULL)
    SQLUDR_SETNULLIND(outInd);
  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.MYTEST.QA_UDF_FLOAT completed with a warning with SQLSTATE 00000. Details: No SQL message text was provided by user-defined function TRAFODION.MYTEST.QA_UDF_FLOAT.

*** WARNING[11250] User-defined function TRAFODION.MYTEST.QA_UDF_DOUBLE_PRECISION completed with a warning with SQLSTATE 00000. Details: No SQL message text was provided by user-defined function TRAFODION.MYTEST.QA_UDF_DOUBLE_PRECISION.

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>/myudf.so';”; in mytest.sql and fill in <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_double_precision
+>(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.MYTEST.QA_UDF_FLOAT completed with a warning with SQLSTATE 00000. Details: No SQL message text was provided by user-defined function TRAFODION.MYTEST.QA_UDF_FLOAT.

OUTVAL
-------------------------

 1.10000000000000016E+000

*** WARNING[11250] User-defined function TRAFODION.MYTEST.QA_UDF_FLOAT completed with a warning with SQLSTATE 00000. Details: No SQL message text was provided by user-defined function TRAFODION.MYTEST.QA_UDF_FLOAT.

--- 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_double_precision(c) from mytable2;

*** WARNING[11250] User-defined function TRAFODION.MYTEST.QA_UDF_DOUBLE_PRECISION completed with a warning with SQLSTATE 00000. Details: No SQL message text was provided by user-defined function TRAFODION.MYTEST.QA_UDF_DOUBLE_PRECISION.

OUTVAL
-------------------------

 2.20000000000000032E+000

*** WARNING[11250] User-defined function TRAFODION.MYTEST.QA_UDF_DOUBLE_PRECISION completed with a warning with SQLSTATE 00000. Details: No SQL message text was provided by user-defined function TRAFODION.MYTEST.QA_UDF_DOUBLE_PRECISION.

--- 1 row(s) selected.
>>
>>drop function qa_udf_float cascade;

--- SQL operation complete.
>>drop function qa_udf_double_precision cascade;

--- SQL operation complete.
>>drop library qa_udf_lib cascade;

--- SQL operation complete.
>>
>>drop schema mytest cascade;

--- SQL operation complete.

Weishiun Tsai (wei-shiun-tsai) wrote :
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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments