You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/03/01 02:05:45 UTC

[jira] [Commented] (TRAFODION-2499) TMUDF sometimes does not pass errors from its input table up to the caller

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

ASF GitHub Bot commented on TRAFODION-2499:
-------------------------------------------

GitHub user zellerh opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/984

    [TRAFODION-2499] TMUDF does not pass error to client

    Added check to avoid clearing out the error when source and
    destination diags area are the same.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zellerh/incubator-trafodion bug/cses_jan-17

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/984.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #984
    
----
commit 3d54fdd2c77f51a7da8f5926326a7eda18637da9
Author: Hans Zeller <hz...@apache.org>
Date:   2017-03-01T02:01:49Z

    [TRAFODION-2499] TMUDF does not pass error to client
    
    Added check to avoid clearing out the error when source and
    destination diags area are the same.

----


> 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)