Teradata Database repeatedly invokes the Java method for a variable mode table UDF, allowing the method to pass through different phases where it initializes itself, accesses system resources, and builds output rows. The method uses Tbl.getPhase() or Tbl.getPhaseEx() to determine which phase it is in and what action to take.
A method that uses Tbl.getPhase() passes through the following phases:
Alternatively, a table UDF that needs to know when it is passed in the last qualified row on an AMP (perhaps because the UDF does not return a row until after it processes all of the input rows) can use Tbl.getPhaseEx() with the TBL_LASTROW option and pass through the following phases:
For details on implementing each phase of a variable mode table UDF, see Implementation Guidelines.