org.apache.hadoop.hive.ql.metadata
Class Partition

java.lang.Object
  extended by org.apache.hadoop.hive.ql.metadata.Partition
All Implemented Interfaces:
Serializable

public class Partition
extends Object
implements Serializable

A Hive Table Partition: is a fundamental storage unit within a Table. Please note that the ql code should always go through methods of this class to access the metadata, instead of directly accessing org.apache.hadoop.hive.metastore.api.Partition. This helps to isolate the metastore code and the ql code.

See Also:
Serialized Form

Constructor Summary
Partition()
          Used only for serialization.
Partition(Table tbl)
          create an empty partition.
Partition(Table tbl, Map<String,String> partSpec, org.apache.hadoop.fs.Path location)
          Create partition object with the given info.
Partition(Table tbl, Partition tp)
           
 
Method Summary
 List<String> getBucketCols()
           
 int getBucketCount()
          The number of buckets is a property of the partition.
 org.apache.hadoop.fs.Path getBucketPath(int bucketNum)
          mapping from bucket number to bucket path
 List<FieldSchema> getCols()
           
 URI getDataLocation()
           
 Deserializer getDeserializer()
           
 Class<? extends org.apache.hadoop.mapred.InputFormat> getInputFormatClass()
           
 String getLocation()
           
 String getName()
           
 Class<? extends HiveOutputFormat> getOutputFormatClass()
           
 Map<String,String> getParameters()
           
 org.apache.hadoop.fs.Path getPartitionPath()
           
 org.apache.hadoop.fs.Path[] getPath()
           
 org.apache.hadoop.fs.Path[] getPath(Sample s)
           
 Properties getSchema()
           
 List<String> getSortColNames()
           
 List<Order> getSortCols()
           
 LinkedHashMap<String,String> getSpec()
           
 Table getTable()
           
 Partition getTPartition()
          Should be only used by serialization.
 List<String> getValues()
           
 void setInputFormatClass(Class<? extends org.apache.hadoop.mapred.InputFormat> inputFormatClass)
           
 void setLocation(String location)
           
 void setOutputFormatClass(Class<? extends HiveOutputFormat> outputFormatClass)
           
 void setTable(Table table)
          Should be only used by serialization.
 void setTPartition(Partition partition)
          Should be only used by serialization.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Partition

public Partition()
Used only for serialization.


Partition

public Partition(Table tbl)
          throws HiveException
create an empty partition. SemanticAnalyzer code requires that an empty partition when the table is not partitioned.

Throws:
HiveException

Partition

public Partition(Table tbl,
                 Partition tp)
          throws HiveException
Throws:
HiveException

Partition

public Partition(Table tbl,
                 Map<String,String> partSpec,
                 org.apache.hadoop.fs.Path location)
          throws HiveException
Create partition object with the given info.

Parameters:
tbl - Table the partition will be in.
partSpec - Partition specifications.
location - Location of the partition, relative to the table.
Throws:
HiveException - Thrown if we could not create the partition.
Method Detail

getValues

public List<String> getValues()
Returns:
The values of the partition
See Also:
Partition.getValues()

getName

public String getName()

getPath

public org.apache.hadoop.fs.Path[] getPath()

getPartitionPath

public org.apache.hadoop.fs.Path getPartitionPath()

getDataLocation

public final URI getDataLocation()

getDeserializer

public final Deserializer getDeserializer()

getSchema

public Properties getSchema()

setInputFormatClass

public void setInputFormatClass(Class<? extends org.apache.hadoop.mapred.InputFormat> inputFormatClass)
Parameters:
inputFormatClass -

setOutputFormatClass

public void setOutputFormatClass(Class<? extends HiveOutputFormat> outputFormatClass)
Parameters:
class1 -

getInputFormatClass

public final Class<? extends org.apache.hadoop.mapred.InputFormat> getInputFormatClass()
                                                                                throws HiveException
Throws:
HiveException

getOutputFormatClass

public final Class<? extends HiveOutputFormat> getOutputFormatClass()
                                                             throws HiveException
Throws:
HiveException

getBucketCount

public int getBucketCount()
The number of buckets is a property of the partition. However - internally we are just storing it as a property of the table as a short term measure.


getBucketCols

public List<String> getBucketCols()

getSortCols

public List<Order> getSortCols()

getSortColNames

public List<String> getSortColNames()

getBucketPath

public org.apache.hadoop.fs.Path getBucketPath(int bucketNum)
mapping from bucket number to bucket path


getPath

public org.apache.hadoop.fs.Path[] getPath(Sample s)
                                    throws HiveException
Throws:
HiveException

getSpec

public LinkedHashMap<String,String> getSpec()

toString

public String toString()
Overrides:
toString in class Object

getTable

public Table getTable()

setTable

public void setTable(Table table)
Should be only used by serialization.


getTPartition

public Partition getTPartition()
Should be only used by serialization.


setTPartition

public void setTPartition(Partition partition)
Should be only used by serialization.


getParameters

public Map<String,String> getParameters()

getCols

public List<FieldSchema> getCols()

getLocation

public String getLocation()

setLocation

public void setLocation(String location)


Copyright © 2010 The Apache Software Foundation