Interface FarragoTransform

All Known Implementing Classes:
FarragoGeneratedCodeExamples.ExampleGeneratedFarragoTransform, FarragoTransformImpl

public interface FarragoTransform

A piece of generated code must implement this interface if it is to be callable from a Fennel JavaTransformExecStream wrapper. See FarragoTransformDef, which manages the construction of a FarragoTransform during statement preparation, in FarragoPreparingStmt.

$Id: //open/dev/farrago/src/net/sf/farrago/runtime/ $
Julian Hyde, Stephan Zuercher

Nested Class Summary
static class FarragoTransform.InputBinding
          InputBinding binds a JavaTransformExecStream input's streamId to the ordinal assigned to that input by the stream graph.
Method Summary
 int execute(ByteBuffer outputBuffer, long quantum)
          Does a quantum of work.
 void init(FarragoRuntimeContext connection, String farragoTransformStreamName, FarragoTransform.InputBinding[] inputBindings)
          Binds all inputs and initializes the transform.
 void restart()
          Restarts this transform's underlying TupleIter(s).
 void setInputFetchTimeout(long millisecs)
          Sets a timeout for fetching an input row.

Method Detail


void init(FarragoRuntimeContext connection,
          String farragoTransformStreamName,
          FarragoTransform.InputBinding[] inputBindings)
Binds all inputs and initializes the transform. This method is typically generated. It is called by FarragoExecutableJavaStmt.execute(net.sf.farrago.session.FarragoSessionRuntimeContext).

connection - the FarragoRuntimeContext of the query that contains this transform.
farragoTransformStreamName - the globally unique name of the ExecStream that implements this transform.
inputBindings - bindings between the transform's input streamIds and the ordinal assigned to them in the stream graph


int execute(ByteBuffer outputBuffer,
            long quantum)
Does a quantum of work. Called by Fennel's JavaTransformExecStream.

outputBuffer - output ByteBuffer into which tuples are marshaled
quantum - the maximum number of tuples that should be processed before returning (in practice this is limited to 2^32)
bytes marshalled into outputBuffer; 0 means end of stream, less than 0 indicates an input underflow


void setInputFetchTimeout(long millisecs)
Sets a timeout for fetching an input row. 0 means poll, infinity (ie Long.MAX_VALUE) means block. The default is to block;


void restart()
Restarts this transform's underlying TupleIter(s).