org.apache.pig.builtin
Annotation Type MonitoredUDF


@InterfaceAudience.Public
@InterfaceStability.Unstable
@Documented
@Inherited
@Retention(value=RUNTIME)
public @interface MonitoredUDF

Describes how the execution of a UDF should be monitored, and what to do if it times out.

NOTE: does not work with UDFs that implement the Accumulator interface

Setting a default value will cause it to be used instead of null when the UDF times out. The appropriate value among in, long, string, etc, is used. The default fields of these annotations are arrays for Java reasons I won't bore you with.

Set them as if they were primitives: @MonitoredUDF( intDefault=5 )

There is currently no way to provide a default ByteArray, Tuple, Map, or Bag. Null will always be used for those.

Currently this annotation is ignored when the Accumulator interface is used.


Optional Element Summary
 double[] doubleDefault
           
 int duration
          Number of time units after which the execution should be halted and default returned.
 Class<? extends MonitoredUDFExecutor.ErrorCallback> errorCallback
          UDF author can implement a static extension of MonitoredUDFExecutor.ErrorCallback and provide its class to the annotation in order to perform custom error handling.
 float[] floatDefault
           
 int[] intDefault
           
 long[] longDefault
           
 String[] stringDefault
           
 TimeUnit timeUnit
          Time Units in which to measure timeout value.
 

timeUnit

public abstract TimeUnit timeUnit
Time Units in which to measure timeout value.

Returns:
Time Units in which to measure timeout value.
Default:
java.util.concurrent.TimeUnit.SECONDS

duration

public abstract int duration
Number of time units after which the execution should be halted and default returned.

Returns:
Number of time units after which the execution should be halted and default returned.
Default:
10

intDefault

public abstract int[] intDefault
Default:
{}

longDefault

public abstract long[] longDefault
Default:
{}

doubleDefault

public abstract double[] doubleDefault
Default:
{}

floatDefault

public abstract float[] floatDefault
Default:
{}

stringDefault

public abstract String[] stringDefault
Default:
{}

errorCallback

public abstract Class<? extends MonitoredUDFExecutor.ErrorCallback> errorCallback
UDF author can implement a static extension of MonitoredUDFExecutor.ErrorCallback and provide its class to the annotation in order to perform custom error handling.

Default:
org.apache.pig.backend.hadoop.executionengine.physicalLayer.util.MonitoredUDFExecutor.ErrorCallback.class


Copyright © 2007-2012 The Apache Software Foundation