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

java.lang.Object
  extended by org.apache.hadoop.hive.ql.metadata.Partition

public class Partition
extends Object

A Hive Table Partition: is a fundamental storage unit within a Table


Constructor Summary
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
protected  void copyFiles(org.apache.hadoop.fs.Path srcf)
          Inserts files specified into the partition.
 List<String> getBucketCols()
           
 int getBucketCount()
          The number of buckets is a property of the partition.
static int getBucketNum(org.apache.hadoop.fs.Path p)
           
 org.apache.hadoop.fs.Path getBucketPath(int bucketNum)
          mapping from bucket number to bucket path
 URI getDataLocation()
           
 String getName()
           
 org.apache.hadoop.fs.Path getPartitionPath()
           
 org.apache.hadoop.fs.Path[] getPath()
           
 org.apache.hadoop.fs.Path[] getPath(Sample s)
           
 LinkedHashMap<String,String> getSpec()
           
 Table getTable()
           
 Partition getTPartition()
           
 List<String> getValues()
           
protected  void replaceFiles(org.apache.hadoop.fs.Path srcf, org.apache.hadoop.fs.Path tmpd)
          Replaces files in the partition with new data set specified by srcf.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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

getTPartition

public Partition getTPartition()
Returns:
the tPartition

getValues

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

getName

public String getName()

getTable

public Table getTable()

getPath

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

getPartitionPath

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

getDataLocation

public final URI getDataLocation()

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()

getBucketPath

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


getBucketNum

public static int getBucketNum(org.apache.hadoop.fs.Path p)

getPath

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

getSpec

public LinkedHashMap<String,String> getSpec()

replaceFiles

protected void replaceFiles(org.apache.hadoop.fs.Path srcf,
                            org.apache.hadoop.fs.Path tmpd)
                     throws HiveException
Replaces files in the partition with new data set specified by srcf. Works by moving files

Parameters:
srcf - Files to be moved. Leaf Directories or Globbed File Paths
tmpd - Temporary directory
Throws:
HiveException

copyFiles

protected void copyFiles(org.apache.hadoop.fs.Path srcf)
                  throws HiveException
Inserts files specified into the partition. Works by moving files

Parameters:
srcf - Files to be moved. Leaf Directories or Globbed File Paths
Throws:
HiveException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation