org.apache.pig.builtin
Class PigStreaming

java.lang.Object
  extended by org.apache.pig.builtin.PigStreaming
All Implemented Interfaces:
PigToStream, StreamToPig

public class PigStreaming
extends Object
implements PigToStream, StreamToPig

The default implementation of PigToStream and StreamToPig interfaces. It converts tuples into fieldDel separated lines and fieldDel separated lines into tuples.


Constructor Summary
PigStreaming()
          The constructor that uses the default field delimiter.
PigStreaming(String delimiter)
          The constructor that accepts a user-specified field delimiter.
 
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.
 byte[] serialize(Tuple t)
          Given a tuple, produce an array of bytes to be passed to the streaming executable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PigStreaming

public PigStreaming()
The constructor that uses the default field delimiter.


PigStreaming

public PigStreaming(String delimiter)
The constructor that accepts a user-specified field delimiter.

Parameters:
delimiter - a String specifying the field delimiter.
Method Detail

serialize

public byte[] serialize(Tuple t)
                 throws IOException
Description copied from interface: PigToStream
Given a tuple, produce an array of bytes to be passed to the streaming executable.

Specified by:
serialize in interface PigToStream
Parameters:
t - Tuple to serialize
Returns:
Serialized form of the tuple
Throws:
IOException

deserialize

public Tuple deserialize(byte[] bytes)
                  throws IOException
Description copied from interface: StreamToPig
Given a byte array from a streaming executable, produce a tuple.

Specified by:
deserialize in interface StreamToPig
Parameters:
bytes - to deserialize.
Returns:
Data as a Pig Tuple.
Throws:
IOException

getLoadCaster

public LoadCaster getLoadCaster()
                         throws IOException
Description copied from interface: StreamToPig
This will be called on the front end during planning and not on the back end during execution.

Specified by:
getLoadCaster in interface StreamToPig
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 © ${year} The Apache Software Foundation