public abstract class AbstractCassandraStorage
extends org.apache.pig.LoadFunc
implements org.apache.pig.StoreFuncInterface, org.apache.pig.LoadMetadata
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractCassandraStorage.CfInfo |
protected static class |
AbstractCassandraStorage.MarshallerType |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
column_family |
protected org.apache.hadoop.conf.Configuration |
conf |
protected java.lang.String |
DEFAULT_INPUT_FORMAT |
protected java.lang.String |
DEFAULT_OUTPUT_FORMAT |
protected java.lang.String |
initHostAddress |
protected java.lang.String |
inputFormatClass |
protected java.lang.String |
keyspace |
protected java.lang.String |
loadSignature |
protected java.lang.String |
outputFormatClass |
static java.lang.String |
PARTITION_FILTER_SIGNATURE |
protected java.lang.String |
partitionerClass |
protected java.lang.String |
password |
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_INPUT_SPLIT_SIZE |
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 |
protected java.lang.String |
rpcPort |
protected int |
splitSize |
protected java.lang.String |
storeSignature |
protected boolean |
usePartitionFilter |
protected java.lang.String |
username |
Constructor and Description |
---|
AbstractCassandraStorage() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
cassandraToObj(AbstractType validator,
java.nio.ByteBuffer value) |
protected static org.apache.cassandra.thrift.CfDef |
cfdefFromString(java.lang.String st)
convert string back to CfDef
|
protected static java.lang.String |
cfdefToString(org.apache.cassandra.thrift.CfDef cfDef)
convert CfDef to string
|
void |
checkSchema(org.apache.pig.ResourceSchema schema) |
void |
cleanupOnFailure(java.lang.String failure,
org.apache.hadoop.mapreduce.Job job) |
void |
cleanupOnSuccess(java.lang.String location,
org.apache.hadoop.mapreduce.Job job) |
protected org.apache.pig.data.Tuple |
columnToTuple(Cell col,
AbstractCassandraStorage.CfInfo cfInfo,
AbstractType comparator)
convert a column to a tuple
|
protected org.apache.pig.data.Tuple |
composeComposite(AbstractCompositeType comparator,
java.nio.ByteBuffer name)
Deconstructs a composite type to a Tuple.
|
protected AbstractCassandraStorage.CfInfo |
getCfInfo(org.apache.cassandra.thrift.Cassandra.Client client)
return the CfInfo for the column family
|
protected AbstractCassandraStorage.CfInfo |
getCfInfo(java.lang.String signature)
get the columnfamily definition for the signature
|
protected CFMetaData |
getCFMetaData(java.lang.String ks,
java.lang.String cf,
org.apache.cassandra.thrift.Cassandra.Client client)
get CFMetaData of a column family
|
protected java.util.List<org.apache.cassandra.thrift.ColumnDef> |
getColumnMeta(org.apache.cassandra.thrift.Cassandra.Client client,
boolean cassandraStorage,
boolean includeCompactValueColumn)
get column meta data
|
protected abstract java.util.List<org.apache.cassandra.thrift.ColumnDef> |
getColumnMetadata(org.apache.cassandra.thrift.Cassandra.Client client)
get a list of columns
|
protected java.util.Map<AbstractCassandraStorage.MarshallerType,AbstractType> |
getDefaultMarshallers(org.apache.cassandra.thrift.CfDef cfDef)
construct a map to store the mashaller type to cassandra data type mapping
|
protected java.lang.String |
getFullyQualifiedClassName(java.lang.String classname)
get the full class name
|
protected java.util.List<org.apache.cassandra.thrift.ColumnDef> |
getIndexes()
get a list of columns with defined index
|
protected org.apache.cassandra.thrift.IndexType |
getIndexType(java.lang.String type)
get index type from string
|
org.apache.hadoop.mapreduce.InputFormat |
getInputFormat() |
org.apache.hadoop.mapreduce.OutputFormat |
getOutputFormat()
output format
|
java.lang.String[] |
getPartitionKeys(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
return partition keys
|
protected byte |
getPigType(AbstractType type)
get pig type for the cassandra data type
|
static java.util.Map<java.lang.String,java.lang.String> |
getQueryMap(java.lang.String query)
decompose the query to store the parameters in a map
|
org.apache.pig.ResourceStatistics |
getStatistics(java.lang.String location,
org.apache.hadoop.mapreduce.Job job) |
protected java.util.Map<java.nio.ByteBuffer,AbstractType> |
getValidatorMap(org.apache.cassandra.thrift.CfDef cfDef)
get the validators
|
protected void |
initSchema(java.lang.String signature)
Methods to get the column family schema from Cassandra
|
protected abstract java.nio.ByteBuffer |
nullToBB() |
protected java.nio.ByteBuffer |
objToBB(java.lang.Object o)
convert object to ByteBuffer
|
protected AbstractType |
parseType(java.lang.String type)
parse the string to a cassandra data type
|
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) |
protected void |
setConnectionInformation()
set hadoop cassandra connection settings
|
void |
setStoreFuncUDFContextSignature(java.lang.String signature)
StoreFunc methods
|
protected void |
setTupleValue(org.apache.pig.data.Tuple pair,
int position,
java.lang.Object value)
set the value to the position of the tuple
|
void |
setUDFContextSignature(java.lang.String signature) |
getAbsolutePath, getLoadCaster, getNext, getPathStrings, join, prepareToRead, setLocation, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String PIG_INPUT_RPC_PORT
public static final java.lang.String PIG_INPUT_INITIAL_ADDRESS
public static final java.lang.String PIG_INPUT_PARTITIONER
public static final java.lang.String PIG_OUTPUT_RPC_PORT
public static final java.lang.String PIG_OUTPUT_INITIAL_ADDRESS
public static final java.lang.String PIG_OUTPUT_PARTITIONER
public static final java.lang.String PIG_RPC_PORT
public static final java.lang.String PIG_INITIAL_ADDRESS
public static final java.lang.String PIG_PARTITIONER
public static final java.lang.String PIG_INPUT_FORMAT
public static final java.lang.String PIG_OUTPUT_FORMAT
public static final java.lang.String PIG_INPUT_SPLIT_SIZE
protected java.lang.String DEFAULT_INPUT_FORMAT
protected java.lang.String DEFAULT_OUTPUT_FORMAT
public static final java.lang.String PARTITION_FILTER_SIGNATURE
protected java.lang.String username
protected java.lang.String password
protected java.lang.String keyspace
protected java.lang.String column_family
protected java.lang.String loadSignature
protected java.lang.String storeSignature
protected org.apache.hadoop.conf.Configuration conf
protected java.lang.String inputFormatClass
protected java.lang.String outputFormatClass
protected int splitSize
protected java.lang.String partitionerClass
protected boolean usePartitionFilter
protected java.lang.String initHostAddress
protected java.lang.String rpcPort
protected org.apache.pig.data.Tuple composeComposite(AbstractCompositeType comparator, java.nio.ByteBuffer name) throws java.io.IOException
java.io.IOException
protected org.apache.pig.data.Tuple columnToTuple(Cell col, AbstractCassandraStorage.CfInfo cfInfo, AbstractType comparator) throws java.io.IOException
java.io.IOException
protected void setTupleValue(org.apache.pig.data.Tuple pair, int position, java.lang.Object value) throws org.apache.pig.backend.executionengine.ExecException
org.apache.pig.backend.executionengine.ExecException
protected AbstractCassandraStorage.CfInfo getCfInfo(java.lang.String signature) throws java.io.IOException
java.io.IOException
protected java.util.Map<AbstractCassandraStorage.MarshallerType,AbstractType> getDefaultMarshallers(org.apache.cassandra.thrift.CfDef cfDef) throws java.io.IOException
java.io.IOException
protected java.util.Map<java.nio.ByteBuffer,AbstractType> getValidatorMap(org.apache.cassandra.thrift.CfDef cfDef) throws java.io.IOException
java.io.IOException
protected AbstractType parseType(java.lang.String type) throws java.io.IOException
java.io.IOException
public org.apache.hadoop.mapreduce.InputFormat getInputFormat() throws java.io.IOException
getInputFormat
in class org.apache.pig.LoadFunc
java.io.IOException
public static java.util.Map<java.lang.String,java.lang.String> getQueryMap(java.lang.String query) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
protected void setConnectionInformation() throws java.io.IOException
java.io.IOException
protected java.lang.String getFullyQualifiedClassName(java.lang.String classname)
protected byte getPigType(AbstractType type)
public org.apache.pig.ResourceStatistics getStatistics(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
getStatistics
in interface org.apache.pig.LoadMetadata
public java.lang.String relativeToAbsolutePath(java.lang.String location, org.apache.hadoop.fs.Path curDir) throws java.io.IOException
relativeToAbsolutePath
in class org.apache.pig.LoadFunc
java.io.IOException
public void setUDFContextSignature(java.lang.String signature)
setUDFContextSignature
in class org.apache.pig.LoadFunc
public void setStoreFuncUDFContextSignature(java.lang.String signature)
setStoreFuncUDFContextSignature
in interface org.apache.pig.StoreFuncInterface
public java.lang.String relToAbsPathForStoreLocation(java.lang.String location, org.apache.hadoop.fs.Path curDir) throws java.io.IOException
relToAbsPathForStoreLocation
in interface org.apache.pig.StoreFuncInterface
java.io.IOException
public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat() throws java.io.IOException
getOutputFormat
in interface org.apache.pig.StoreFuncInterface
java.io.IOException
public void checkSchema(org.apache.pig.ResourceSchema schema) throws java.io.IOException
checkSchema
in interface org.apache.pig.StoreFuncInterface
java.io.IOException
protected abstract java.nio.ByteBuffer nullToBB()
protected java.nio.ByteBuffer objToBB(java.lang.Object o)
public void cleanupOnFailure(java.lang.String failure, org.apache.hadoop.mapreduce.Job job)
cleanupOnFailure
in interface org.apache.pig.StoreFuncInterface
public void cleanupOnSuccess(java.lang.String location, org.apache.hadoop.mapreduce.Job job) throws java.io.IOException
cleanupOnSuccess
in interface org.apache.pig.StoreFuncInterface
java.io.IOException
protected void initSchema(java.lang.String signature) throws java.io.IOException
java.io.IOException
protected static java.lang.String cfdefToString(org.apache.cassandra.thrift.CfDef cfDef) throws java.io.IOException
java.io.IOException
protected static org.apache.cassandra.thrift.CfDef cfdefFromString(java.lang.String st) throws java.io.IOException
java.io.IOException
protected AbstractCassandraStorage.CfInfo getCfInfo(org.apache.cassandra.thrift.Cassandra.Client client) throws org.apache.cassandra.thrift.InvalidRequestException, org.apache.cassandra.thrift.UnavailableException, org.apache.cassandra.thrift.TimedOutException, org.apache.cassandra.thrift.SchemaDisagreementException, org.apache.thrift.TException, org.apache.cassandra.thrift.NotFoundException, InvalidRequestException, ConfigurationException, java.io.IOException
org.apache.cassandra.thrift.InvalidRequestException
org.apache.cassandra.thrift.UnavailableException
org.apache.cassandra.thrift.TimedOutException
org.apache.cassandra.thrift.SchemaDisagreementException
org.apache.thrift.TException
org.apache.cassandra.thrift.NotFoundException
ConfigurationException
java.io.IOException
protected abstract java.util.List<org.apache.cassandra.thrift.ColumnDef> getColumnMetadata(org.apache.cassandra.thrift.Cassandra.Client client) throws org.apache.cassandra.thrift.InvalidRequestException, org.apache.cassandra.thrift.UnavailableException, org.apache.cassandra.thrift.TimedOutException, org.apache.cassandra.thrift.SchemaDisagreementException, org.apache.thrift.TException, java.nio.charset.CharacterCodingException, InvalidRequestException, ConfigurationException, org.apache.cassandra.thrift.NotFoundException
org.apache.cassandra.thrift.InvalidRequestException
org.apache.cassandra.thrift.UnavailableException
org.apache.cassandra.thrift.TimedOutException
org.apache.cassandra.thrift.SchemaDisagreementException
org.apache.thrift.TException
java.nio.charset.CharacterCodingException
ConfigurationException
org.apache.cassandra.thrift.NotFoundException
protected java.util.List<org.apache.cassandra.thrift.ColumnDef> getColumnMeta(org.apache.cassandra.thrift.Cassandra.Client client, boolean cassandraStorage, boolean includeCompactValueColumn) throws org.apache.cassandra.thrift.InvalidRequestException, org.apache.cassandra.thrift.UnavailableException, org.apache.cassandra.thrift.TimedOutException, org.apache.cassandra.thrift.SchemaDisagreementException, org.apache.thrift.TException, java.nio.charset.CharacterCodingException, InvalidRequestException, ConfigurationException, org.apache.cassandra.thrift.NotFoundException
org.apache.cassandra.thrift.InvalidRequestException
org.apache.cassandra.thrift.UnavailableException
org.apache.cassandra.thrift.TimedOutException
org.apache.cassandra.thrift.SchemaDisagreementException
org.apache.thrift.TException
java.nio.charset.CharacterCodingException
ConfigurationException
org.apache.cassandra.thrift.NotFoundException
protected org.apache.cassandra.thrift.IndexType getIndexType(java.lang.String type)
public java.lang.String[] getPartitionKeys(java.lang.String location, org.apache.hadoop.mapreduce.Job job) throws java.io.IOException
getPartitionKeys
in interface org.apache.pig.LoadMetadata
java.io.IOException
protected java.util.List<org.apache.cassandra.thrift.ColumnDef> getIndexes() throws java.io.IOException
java.io.IOException
protected CFMetaData getCFMetaData(java.lang.String ks, java.lang.String cf, org.apache.cassandra.thrift.Cassandra.Client client) throws org.apache.cassandra.thrift.NotFoundException, org.apache.cassandra.thrift.InvalidRequestException, org.apache.thrift.TException, InvalidRequestException, ConfigurationException
org.apache.cassandra.thrift.NotFoundException
org.apache.cassandra.thrift.InvalidRequestException
org.apache.thrift.TException
ConfigurationException
protected java.lang.Object cassandraToObj(AbstractType validator, java.nio.ByteBuffer value)
Copyright © 2014 The Apache Software Foundation