Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-2499

TMUDF sometimes does not pass errors from its input table up to the caller

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-incubating
    • 2.2.0
    • sql-exe
    • None
    • Any

    Description

      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:

      *** 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;
      
      

      Attachments

        Issue Links

          Activity

            People

              hzeller Hans Zeller
              hzeller Hans Zeller
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: