org.apache.pig.builtin
Class PigStreaming

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

public class PigStreaming
extends PigStreamingBase

The default implementation of PigStreamingBase. 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, int offset, int length)
          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.
 WritableByteArray serializeToBytes(Tuple t)
          Given a tuple, produce an array of bytes to be passed to the streaming executable.
 
Methods inherited from class org.apache.pig.PigStreamingBase
deserialize, serialize
 
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

serializeToBytes

public WritableByteArray serializeToBytes(Tuple t)
                                   throws IOException
Description copied from class: PigStreamingBase
Given a tuple, produce an array of bytes to be passed to the streaming executable.

Specified by:
serializeToBytes in class PigStreamingBase
Parameters:
t - Tuple to serialize
Returns:
Serialized form of the tuple
Throws:
IOException

deserialize

public Tuple deserialize(byte[] bytes,
                         int offset,
                         int length)
                  throws IOException
Description copied from class: PigStreamingBase
Given a byte array from a streaming executable, produce a tuple.

Specified by:
deserialize in class PigStreamingBase
Parameters:
bytes - bytes to deserialize.
offset - the offset in the byte array from which to deserialize.
length - the number of bytes from the offset of the byte array to deserialize.
Returns:
Data as a Pig Tuple.
Throws:
IOException

getLoadCaster

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

Specified by:
getLoadCaster in interface StreamToPig
Specified by:
getLoadCaster in class PigStreamingBase
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 © 2007-2012 The Apache Software Foundation