org.apache.pig.piggybank.storage
Class HiveColumnarStorage

java.lang.Object
  extended by org.apache.pig.LoadFunc
      extended by org.apache.pig.FileInputLoadFunc
          extended by org.apache.pig.builtin.PigStorage
              extended by org.apache.pig.piggybank.storage.HiveColumnarStorage
All Implemented Interfaces:
LoadMetadata, LoadPushDown, OrderedLoadFunc, OverwritableStoreFunc, StoreFuncInterface, StoreMetadata

public class HiveColumnarStorage
extends PigStorage


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pig.LoadPushDown
LoadPushDown.OperatorSet, LoadPushDown.RequiredField, LoadPushDown.RequiredFieldList, LoadPushDown.RequiredFieldResponse
 
Field Summary
 
Fields inherited from class org.apache.pig.builtin.PigStorage
caster, in, mLog, mRequiredColumns, schema, signature, writer
 
Constructor Summary
HiveColumnarStorage()
           
 
Method Summary
 void checkSchema(ResourceSchema s)
          Set the schema for data to be stored.
 org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
          Return the OutputFormat associated with StoreFuncInterface.
 void putField(OutputStream out, Object field)
           
 void putNext(Tuple t)
          Write a tuple to the data store.
 void setStoreLocation(String location, org.apache.hadoop.mapreduce.Job job)
          Communicate to the storer the location where the data needs to be stored.
 
Methods inherited from class org.apache.pig.builtin.PigStorage
cleanupOnFailure, cleanupOnSuccess, cleanupOutput, equals, equals, getFeatures, getInputFormat, getNext, getPartitionKeys, getSchema, getStatistics, hashCode, prepareToRead, prepareToWrite, pushProjection, readField, relToAbsPathForStoreLocation, setLocation, setPartitionFilter, setStoreFuncUDFContextSignature, setUDFContextSignature, shouldOverwrite, storeSchema, storeStatistics
 
Methods inherited from class org.apache.pig.FileInputLoadFunc
getSplitComparable
 
Methods inherited from class org.apache.pig.LoadFunc
getAbsolutePath, getLoadCaster, getPathStrings, join, relativeToAbsolutePath, warn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HiveColumnarStorage

public HiveColumnarStorage()
Method Detail

getOutputFormat

public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
Description copied from interface: StoreFuncInterface
Return the OutputFormat associated with StoreFuncInterface. This will be called on the front end during planning and on the backend during execution.

Specified by:
getOutputFormat in interface StoreFuncInterface
Overrides:
getOutputFormat in class PigStorage
Returns:
the OutputFormat associated with StoreFuncInterface

setStoreLocation

public void setStoreLocation(String location,
                             org.apache.hadoop.mapreduce.Job job)
                      throws IOException
Description copied from interface: StoreFuncInterface
Communicate to the storer the location where the data needs to be stored. The location string passed to the StoreFuncInterface here is the return value of StoreFuncInterface.relToAbsPathForStoreLocation(String, Path) This method will be called in the frontend and backend multiple times. Implementations should bear in mind that this method is called multiple times and should ensure there are no inconsistent side effects due to the multiple calls. StoreFuncInterface.checkSchema(ResourceSchema) will be called before any call to StoreFuncInterface.setStoreLocation(String, Job).

Specified by:
setStoreLocation in interface StoreFuncInterface
Overrides:
setStoreLocation in class PigStorage
Parameters:
location - Location returned by StoreFuncInterface.relToAbsPathForStoreLocation(String, Path)
job - The Job object
Throws:
IOException - if the location is not valid.

checkSchema

public void checkSchema(ResourceSchema s)
                 throws IOException
Description copied from interface: StoreFuncInterface
Set the schema for data to be stored. This will be called on the front end during planning if the store is associated with a schema. A Store function should implement this function to check that a given schema is acceptable to it. For example, it can check that the correct partition keys are included; a storage function to be written directly to an OutputFormat can make sure the schema will translate in a well defined way.

Specified by:
checkSchema in interface StoreFuncInterface
Overrides:
checkSchema in class PigStorage
Parameters:
s - to be checked
Throws:
IOException - if this schema is not acceptable. It should include a detailed error message indicating what is wrong with the schema.

putNext

public void putNext(Tuple t)
             throws IOException
Description copied from interface: StoreFuncInterface
Write a tuple to the data store.

Specified by:
putNext in interface StoreFuncInterface
Overrides:
putNext in class PigStorage
Parameters:
t - the tuple to store.
Throws:
IOException - if an exception occurs during the write

putField

public void putField(OutputStream out,
                     Object field)
              throws IOException
Throws:
IOException


Copyright © 2007-2012 The Apache Software Foundation