[ 
https://issues.apache.org/jira/browse/TRAFODION-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15881910#comment-15881910
 ] 

Hans Zeller commented on TRAFODION-2499:
----------------------------------------

This problem was originally found by David Wong.

> TMUDF sometimes does not pass errors from its input table up to the caller
> --------------------------------------------------------------------------
>
>                 Key: TRAFODION-2499
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2499
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-exe
>    Affects Versions: 2.0-incubating
>         Environment: Any
>            Reporter: Hans Zeller
>
> This only happens in very limited circumstances. In the test case below, we 
> get an error while processing the input table of the UDF. In this case it's a 
> duplicate key error. But, the caller of the UDF gets this error message:
> {noformat}
> *** ERROR[8810] Executor ran into an internal failure and returned an error 
> without populating the diagnostics area. This error is being injected to 
> indicate that.
> Here is the UDF code (file SimpleFunc.java):
> import org.trafodion.sql.udr.*;
> public class SimpleFunc extends UDR {
>       // empty constructor
>       public SimpleFunc() {}
>       
>       @Override
>       public void describeParamsAndColumns(UDRInvocationInfo info)
>        throws UDRException
>       {
>               info.out().addLongColumn("ROWS_IN", false);
>       }
>       
>       @Override
>       public void processData(UDRInvocationInfo info,
>                               UDRPlanInfo plan)
>               throws UDRException
>       {
>               long rowCount = 0;
>               try {
>                       while (getNextRow(info)) {
>                               rowCount++;
>                               
>                       } // while processData rows
>                       info.out().setLong(0, rowCount);
>                       emitRow(info);
>               } // try
>               catch (Exception ex) {
>                       throw new UDRException (38110, "processData exception: 
> " + ex.getMessage());
>               }
>       }
>       
> }
> Here is how to compile file SimpleFunc.java:
> $JAVA_HOME/bin/javac SimpleFunc.java
> jar cvf simple_func.jar SimpleFunc.*
> Here are the SQL statements:
> -- create library
> create library simple_func file '..../simple_func.jar';
> -- create UDF
> drop TABLE_MAPPING FUNCTION simple_func;
> CREATE TABLE_MAPPING FUNCTION simple_func()
> EXTERNAL NAME 'SimpleFunc'
> LIBRARY simple_func
> LANGUAGE JAVA
> ;
> drop table tgt;
> create table tgt (
>      pk        smallint not null no default,
>      val       varchar(100),
>      primary key (pk)
> )
> attributes aligned format
> ;
> insert into tgt values (1,'x');
> cqd udr_debug_flags '16';
> prepare s from
> SELECT *
> FROM UDF(simple_func(TABLE(
>                            select pk, val
>                            from (INSERT INTO tgt values ( 1, 'DAVID')) t
>                           )))
> ;
> execute s;
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to