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

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

The problem is in ExUdrTcb::insertUpQueueEntry(). If the diags area passed to 
this method is the same as the diags area in the down queue entry, then we 
actually clear all the errors in it by mistake. I'll add a check for this 
situation.

> 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
>            Assignee: 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