org.apache.pig.backend.executionengine
Class PigSlice

java.lang.Object
  extended by org.apache.pig.backend.executionengine.PigSlice
All Implemented Interfaces:
Serializable, Slice

public class PigSlice
extends Object
implements Slice

Slice that loads data using a LoadFunc.

See Also:
Serialized Form

Constructor Summary
PigSlice(String path, String parser, long start, long length)
           
 
Method Summary
 void close()
          Closes any streams this Slice has opened as part of its work.
 long getLength()
          Returns the length in bytes of all of the data that will be processed by this Slice.
 String[] getLocations()
          Returns string representations of all the files that will be used as part of processing this Slice.
 long getPos()
          Returns the number of bytes read so far as part of processing this Slice.
 float getProgress()
          Returns the percentage of Slice that is complete from 0.0 to 1.0.
 long getStart()
          Returns the offset from which data in this Slice will be processed.
 void init(DataStorage base)
          Initializes this Slice with the DataStorage it's to use to do its work.
 boolean next(Tuple value)
          Loads the next value from this Slice into value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PigSlice

public PigSlice(String path,
                String parser,
                long start,
                long length)
Method Detail

getLocations

public String[] getLocations()
Description copied from interface: Slice
Returns string representations of all the files that will be used as part of processing this Slice.

This is the only method on Slice that is valid to call before Slice.init(DataStorage) has been called.

Specified by:
getLocations in interface Slice

getStart

public long getStart()
Description copied from interface: Slice
Returns the offset from which data in this Slice will be processed.

Specified by:
getStart in interface Slice

getLength

public long getLength()
Description copied from interface: Slice
Returns the length in bytes of all of the data that will be processed by this Slice.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
getLength in interface Slice

init

public void init(DataStorage base)
          throws IOException
Description copied from interface: Slice
Initializes this Slice with the DataStorage it's to use to do its work.

This will always be called before getLength, close, getPos, getProgress and next.

Specified by:
init in interface Slice
Throws:
IOException

next

public boolean next(Tuple value)
             throws IOException
Description copied from interface: Slice
Loads the next value from this Slice into value.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
next in interface Slice
Parameters:
value - - the Tuple to be filled with the next value.
Returns:
- true if there are more Tuples to be read.
Throws:
IOException

getPos

public long getPos()
            throws IOException
Description copied from interface: Slice
Returns the number of bytes read so far as part of processing this Slice.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
getPos in interface Slice
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: Slice
Closes any streams this Slice has opened as part of its work.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
close in interface Slice
Throws:
IOException

getProgress

public float getProgress()
                  throws IOException
Description copied from interface: Slice
Returns the percentage of Slice that is complete from 0.0 to 1.0.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
getProgress in interface Slice
Throws:
IOException


Copyright © ${year} The Apache Software Foundation