You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Alice Chen (JIRA)" <ji...@apache.org> on 2015/07/22 20:20:07 UTC

[jira] [Created] (TRAFODION-1122) LP Bug: 1439376 - UDF: Scalar UDF returns strange warnings when handling SQLUDR_DOUBLE

Alice Chen created TRAFODION-1122:
-------------------------------------

             Summary: LP Bug: 1439376 - UDF: Scalar UDF returns strange warnings when handling SQLUDR_DOUBLE
                 Key: TRAFODION-1122
                 URL: https://issues.apache.org/jira/browse/TRAFODION-1122
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-exe
            Reporter: Weishiun Tsai
            Assignee: Suresh Subbiah
            Priority: Critical
             Fix For: 2.0-incubating


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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)