org.apache.pig
Interface StreamToPig

All Known Implementing Classes:
PigStreaming

@InterfaceAudience.Public
@InterfaceStability.Stable
public interface StreamToPig

The interface is used for the custom mapping of a byte array, received from the stdout of the streaming process, to a Tuple. This interface, together with PigToStream, is designed to provide a common protocol for data exchange between Pig runtime and streaming executables. The method getLoadCaster is called by Pig to convert the fields in the byte array to typed fields of the Tuple based on a given schema. Typically, user implements this interface for a particular type of stream command and specifies the implementation class in the Pig DEFINE statement.

Since:
Pig 0.7

Method Summary
 Tuple deserialize(byte[] bytes)
          Given a byte array from a streaming executable, produce a tuple.
 LoadCaster getLoadCaster()
          This will be called on the front end during planning and not on the back end during execution.
 

Method Detail

deserialize

Tuple deserialize(byte[] bytes)
                  throws IOException
Given a byte array from a streaming executable, produce a tuple.

Parameters:
bytes - to deserialize.
Returns:
Data as a Pig Tuple.
Throws:
IOException

getLoadCaster

LoadCaster getLoadCaster()
                         throws IOException
This will be called on the front end during planning and not on the back end during execution.

Returns:
the LoadCaster associated with this object, or null if there is no such LoadCaster.
Throws:
IOException - if there is an exception during LoadCaster


Copyright © 2012 The Apache Software Foundation