org.apache.hadoop.hive.ql.exec.persistence
Class RowContainer<Row extends List>

java.lang.Object
  extended by org.apache.hadoop.hive.ql.exec.persistence.RowContainer<Row>

public class RowContainer<Row extends List>
extends Object

Simple persistent container for rows. This container interface only accepts adding or appending new rows and iterating through the rows in the order of their insertions. The iterator interface is a lightweight first()/next() API rather than the Java Iterator interface. This way we do not need to create an Iterator object every time we want to start a new iteration. Below is simple example of how to convert a typical Java's Iterator code to the LW iterator iterface. Itereator itr = rowContainer.iterator(); while (itr.hasNext()) { v = itr.next(); // do anything with v } can be rewritten to: for ( v = rowContainer.first(); v != null; v = rowContainer.next()) { // do anything with v } The adding and iterating operations can be interleaving.


Field Summary
protected  org.apache.commons.logging.Log LOG
           
 
Constructor Summary
RowContainer()
           
RowContainer(int blockSize)
           
RowContainer(int blockSize, SerDe sd, ObjectInspector oi)
           
 
Method Summary
 void add(Row t)
           
 void clear()
          Remove all elements in the RowContainer.
 Row first()
           
 Row next()
           
 void setSerDe(SerDe sd, ObjectInspector oi)
           
 void setTableDesc(tableDesc tblDesc)
           
 int size()
          Get the number of elements in the RowContainer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected org.apache.commons.logging.Log LOG
Constructor Detail

RowContainer

public RowContainer()

RowContainer

public RowContainer(int blockSize)

RowContainer

public RowContainer(int blockSize,
                    SerDe sd,
                    ObjectInspector oi)
Method Detail

setSerDe

public void setSerDe(SerDe sd,
                     ObjectInspector oi)

add

public void add(Row t)
         throws HiveException
Throws:
HiveException

first

public Row first()

next

public Row next()

size

public int size()
Get the number of elements in the RowContainer.

Returns:
number of elements in the RowContainer

clear

public void clear()
           throws HiveException
Remove all elements in the RowContainer.

Throws:
HiveException

setTableDesc

public void setTableDesc(tableDesc tblDesc)


Copyright © 2009 The Apache Software Foundation