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:19:33 UTC

[jira] [Created] (TRAFODION-1045) LP Bug: 1430484 - TMUDF: User defined error number for UDRException() not returned at run time

Alice Chen created TRAFODION-1045:
-------------------------------------

             Summary: LP Bug: 1430484 - TMUDF: User defined error number for UDRException() not returned at run time
                 Key: TRAFODION-1045
                 URL: https://issues.apache.org/jira/browse/TRAFODION-1045
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-exe
            Reporter: Weishiun Tsai
            Assignee: Hans Zeller
             Fix For: 1.1 (pre-incubation)


Throwing an UDRException() from a compile time interface, such as describeParamsAndColumns(), properly returns the user defined error number.  However, doing so from the run time interface processData() somehow loses the error number.  Only the error message is returned.

As shown here in the example, the TMUDF throws an UDRException() with the user defined error number 38001.  But when executed, only the error message was propagated back.

void QATmudf::processData(UDRInvocationInfo &info, UDRPlanInfo &plan)
{
  throw UDRException(38001, "test exception in process data");
}

This is seen on the v0305 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 from <mydir> to build the UDF so file.
(4) Change the line create library qaTmudfLib file '<mydir>/qaTMUdfTest.so'; in mytest.sql and fill in <mydir>
(5) From sqlci, obey mytest.sql

-------------------------------------------------------------------------

Here is the execution output:

>>log mytest.log clear;
>>drop schema mytest cascade;

*** ERROR[1003] Schema TRAFODION.MYTEST does not exist.

--- SQL operation failed with errors.
>>create schema mytest;

--- SQL operation complete.
>>set schema mytest;

--- SQL operation complete.
>>
>>create library qaTmudfLib file '/designs/seaquest/wtsai/udf_bugs/udf_bug/qaTMUdfTest.so';

--- SQL operation complete.
>>
>>create table mytable (a int, b int);

--- SQL operation complete.
>>insert into mytable values (1,1),(2,2);

--- 2 row(s) inserted.
>>
>>create table_mapping function qa_tmudf()
+>external name 'QA_TMUDF'
+>language cpp
+>library qaTmudfLib;

--- SQL operation complete.
>>
>>select * from UDF(qa_tmudf(TABLE(select * from mytable)));

*** ERROR[11249] User-defined function QA_TMUDF completed with an error with SQLSTATE . Details: test exception in process data.

*** ERROR[2037] $Z0001XI:172: A message from process $Z00029T:175 was incorrectly formatted and could not be processed.

*** ERROR[8906] An invalid or corrupt MXUDR reply could not be processed, possibly due to memory corruption in MXUDR while executing user-defined routines or an internal error in SQL.

--- 0 row(s) selected.
>>
>>drop schema mytest cascade;

--- SQL operation complete.
>>
>>exit;

End of MXCI Session



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