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:36 UTC

[jira] [Created] (TRAFODION-1064) LP Bug: 1433192 - TMUDF: TableInfo::getNumRows() returns wrong count

Alice Chen created TRAFODION-1064:
-------------------------------------

             Summary: LP Bug: 1433192 - TMUDF: TableInfo::getNumRows() returns wrong count
                 Key: TRAFODION-1064
                 URL: https://issues.apache.org/jira/browse/TRAFODION-1064
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-exe
            Reporter: Weishiun Tsai
            Assignee: Hans Zeller
            Priority: Critical
             Fix For: 2.0-incubating


As shown in the following example, TableInfo::getNumRows() returuns -1 while the input table has 5 rows.  In the same example, it also shows that getNextRow() loops through the correct number of iteration even though TableInfo::getNumRows() returns an incorrect value.

This is seen on the v0312 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 showing that the program raised a user-defined exception when TableInfo::getNumRows() returned a wrong number.

>>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 '<mydir>/qaTmudfTest.so';

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

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

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

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

*** ERROR[11252] Wrong input table row count:
Invalid getNumRows(): expecting 5 got -1
 (SQLSTATE 38001)

*** ERROR[2037] $Z000QRX:79: A message from process $Z000RKV:82 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;



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