org.apache.cassandra.hadoop.pig
Class CassandraStorage

java.lang.Object
  extended by org.apache.pig.LoadFunc
      extended by org.apache.cassandra.hadoop.pig.CassandraStorage
All Implemented Interfaces:
org.apache.pig.LoadMetadata, org.apache.pig.StoreFuncInterface

public class CassandraStorage
extends org.apache.pig.LoadFunc
implements org.apache.pig.StoreFuncInterface, org.apache.pig.LoadMetadata

A LoadStoreFunc for retrieving data from and storing data to Cassandra A row from a standard CF will be returned as nested tuples: (key, ((name1, val1), (name2, val2))).


Field Summary
static java.lang.String PIG_ALLOW_DELETES
           
static java.lang.String PIG_INITIAL_ADDRESS
           
static java.lang.String PIG_INPUT_FORMAT
           
static java.lang.String PIG_INPUT_INITIAL_ADDRESS
           
static java.lang.String PIG_INPUT_PARTITIONER
           
static java.lang.String PIG_INPUT_RPC_PORT
           
static java.lang.String PIG_OUTPUT_FORMAT
           
static java.lang.String PIG_OUTPUT_INITIAL_ADDRESS
           
static java.lang.String PIG_OUTPUT_PARTITIONER
           
static java.lang.String PIG_OUTPUT_RPC_PORT
           
static java.lang.String PIG_PARTITIONER
           
static java.lang.String PIG_RPC_PORT
           
static java.lang.String PIG_USE_SECONDARY
           
static java.lang.String PIG_WIDEROW_INPUT
           
 
Constructor Summary
CassandraStorage()
           
CassandraStorage(int limit)
           
 
Method Summary
 void checkSchema(org.apache.pig.ResourceSchema schema)
           
 void cleanupOnFailure(java.lang.String failure, org.apache.hadoop.mapreduce.Job job)
           
 org.apache.hadoop.mapreduce.InputFormat getInputFormat()
           
 int getLimit()
           
 org.apache.pig.data.Tuple getNext()
           
 org.apache.pig.data.Tuple getNextWide()
           
 org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
           
 java.lang.String[] getPartitionKeys(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
static java.util.Map<java.lang.String,java.lang.String> getQueryMap(java.lang.String query)
           
 org.apache.pig.ResourceSchema getSchema(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
 org.apache.pig.ResourceStatistics getStatistics(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
 void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader, org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit split)
           
 void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
           
 void putNext(org.apache.pig.data.Tuple t)
           
 java.lang.String relativeToAbsolutePath(java.lang.String location, org.apache.hadoop.fs.Path curDir)
           
 java.lang.String relToAbsPathForStoreLocation(java.lang.String location, org.apache.hadoop.fs.Path curDir)
           
 void setLocation(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
 void setPartitionFilter(org.apache.pig.Expression partitionFilter)
           
 void setStoreFuncUDFContextSignature(java.lang.String signature)
           
 void setStoreLocation(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
 void setUDFContextSignature(java.lang.String signature)
           
 
Methods inherited from class org.apache.pig.LoadFunc
getAbsolutePath, getLoadCaster, getPathStrings, join, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIG_INPUT_RPC_PORT

public static final java.lang.String PIG_INPUT_RPC_PORT
See Also:
Constant Field Values

PIG_INPUT_INITIAL_ADDRESS

public static final java.lang.String PIG_INPUT_INITIAL_ADDRESS
See Also:
Constant Field Values

PIG_INPUT_PARTITIONER

public static final java.lang.String PIG_INPUT_PARTITIONER
See Also:
Constant Field Values

PIG_OUTPUT_RPC_PORT

public static final java.lang.String PIG_OUTPUT_RPC_PORT
See Also:
Constant Field Values

PIG_OUTPUT_INITIAL_ADDRESS

public static final java.lang.String PIG_OUTPUT_INITIAL_ADDRESS
See Also:
Constant Field Values

PIG_OUTPUT_PARTITIONER

public static final java.lang.String PIG_OUTPUT_PARTITIONER
See Also:
Constant Field Values

PIG_RPC_PORT

public static final java.lang.String PIG_RPC_PORT
See Also:
Constant Field Values

PIG_INITIAL_ADDRESS

public static final java.lang.String PIG_INITIAL_ADDRESS
See Also:
Constant Field Values

PIG_PARTITIONER

public static final java.lang.String PIG_PARTITIONER
See Also:
Constant Field Values

PIG_INPUT_FORMAT

public static final java.lang.String PIG_INPUT_FORMAT
See Also:
Constant Field Values

PIG_OUTPUT_FORMAT

public static final java.lang.String PIG_OUTPUT_FORMAT
See Also:
Constant Field Values

PIG_ALLOW_DELETES

public static final java.lang.String PIG_ALLOW_DELETES
See Also:
Constant Field Values

PIG_WIDEROW_INPUT

public static final java.lang.String PIG_WIDEROW_INPUT
See Also:
Constant Field Values

PIG_USE_SECONDARY

public static final java.lang.String PIG_USE_SECONDARY
See Also:
Constant Field Values
Constructor Detail

CassandraStorage

public CassandraStorage()

CassandraStorage

public CassandraStorage(int limit)
Parameters:
limit - number of columns to fetch in a slice
Method Detail

getLimit

public int getLimit()

getNextWide

public org.apache.pig.data.Tuple getNextWide()
                                      throws java.io.IOException
Throws:
java.io.IOException

getNext

public org.apache.pig.data.Tuple getNext()
                                  throws java.io.IOException
Specified by:
getNext in class org.apache.pig.LoadFunc
Throws:
java.io.IOException

getInputFormat

public org.apache.hadoop.mapreduce.InputFormat getInputFormat()
Specified by:
getInputFormat in class org.apache.pig.LoadFunc

prepareToRead

public void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
                          org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit split)
Specified by:
prepareToRead in class org.apache.pig.LoadFunc

getQueryMap

public static java.util.Map<java.lang.String,java.lang.String> getQueryMap(java.lang.String query)

setLocation

public void setLocation(java.lang.String location,
                        org.apache.hadoop.mapreduce.Job job)
                 throws java.io.IOException
Specified by:
setLocation in class org.apache.pig.LoadFunc
Throws:
java.io.IOException

getSchema

public org.apache.pig.ResourceSchema getSchema(java.lang.String location,
                                               org.apache.hadoop.mapreduce.Job job)
                                        throws java.io.IOException
Specified by:
getSchema in interface org.apache.pig.LoadMetadata
Throws:
java.io.IOException

getStatistics

public org.apache.pig.ResourceStatistics getStatistics(java.lang.String location,
                                                       org.apache.hadoop.mapreduce.Job job)
Specified by:
getStatistics in interface org.apache.pig.LoadMetadata

getPartitionKeys

public java.lang.String[] getPartitionKeys(java.lang.String location,
                                           org.apache.hadoop.mapreduce.Job job)
Specified by:
getPartitionKeys in interface org.apache.pig.LoadMetadata

setPartitionFilter

public void setPartitionFilter(org.apache.pig.Expression partitionFilter)
Specified by:
setPartitionFilter in interface org.apache.pig.LoadMetadata

relativeToAbsolutePath

public java.lang.String relativeToAbsolutePath(java.lang.String location,
                                               org.apache.hadoop.fs.Path curDir)
                                        throws java.io.IOException
Overrides:
relativeToAbsolutePath in class org.apache.pig.LoadFunc
Throws:
java.io.IOException

setUDFContextSignature

public void setUDFContextSignature(java.lang.String signature)
Overrides:
setUDFContextSignature in class org.apache.pig.LoadFunc

setStoreFuncUDFContextSignature

public void setStoreFuncUDFContextSignature(java.lang.String signature)
Specified by:
setStoreFuncUDFContextSignature in interface org.apache.pig.StoreFuncInterface

relToAbsPathForStoreLocation

public java.lang.String relToAbsPathForStoreLocation(java.lang.String location,
                                                     org.apache.hadoop.fs.Path curDir)
                                              throws java.io.IOException
Specified by:
relToAbsPathForStoreLocation in interface org.apache.pig.StoreFuncInterface
Throws:
java.io.IOException

setStoreLocation

public void setStoreLocation(java.lang.String location,
                             org.apache.hadoop.mapreduce.Job job)
                      throws java.io.IOException
Specified by:
setStoreLocation in interface org.apache.pig.StoreFuncInterface
Throws:
java.io.IOException

getOutputFormat

public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
Specified by:
getOutputFormat in interface org.apache.pig.StoreFuncInterface

checkSchema

public void checkSchema(org.apache.pig.ResourceSchema schema)
                 throws java.io.IOException
Specified by:
checkSchema in interface org.apache.pig.StoreFuncInterface
Throws:
java.io.IOException

prepareToWrite

public void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
Specified by:
prepareToWrite in interface org.apache.pig.StoreFuncInterface

putNext

public void putNext(org.apache.pig.data.Tuple t)
             throws java.io.IOException
Specified by:
putNext in interface org.apache.pig.StoreFuncInterface
Throws:
java.io.IOException

cleanupOnFailure

public void cleanupOnFailure(java.lang.String failure,
                             org.apache.hadoop.mapreduce.Job job)
Specified by:
cleanupOnFailure in interface org.apache.pig.StoreFuncInterface


Copyright © 2013 The Apache Software Foundation