public class CqlNativeStorage
extends org.apache.pig.LoadFunc
implements org.apache.pig.StoreFuncInterface, org.apache.pig.LoadMetadata
| 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 int |
nativeProtocolVersion |
protected java.lang.String |
outputFormatClass |
protected java.lang.String |
partitionerClass |
protected java.lang.String |
password |
protected java.lang.String |
rpcPort |
protected int |
splitSize |
protected java.lang.String |
storeSignature |
protected boolean |
usePartitionFilter |
protected java.lang.String |
username |
| Constructor and Description |
|---|
CqlNativeStorage() |
CqlNativeStorage(int pageSize) |
| Modifier and Type | Method and Description |
|---|---|
protected static org.apache.cassandra.hadoop.pig.TableInfo |
cfdefFromString(java.lang.String st)
convert string back to CfDef
|
protected static java.lang.String |
cfdefToString(com.datastax.driver.core.TableMetadata 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 com.datastax.driver.core.TableMetadata |
getCfInfo(com.datastax.driver.core.Session client)
return the CfInfo for the column family
|
protected org.apache.cassandra.hadoop.pig.TableInfo |
getCfInfo(java.lang.String signature)
get the columnfamily definition for the signature
|
protected java.lang.String |
getFullyQualifiedClassName(java.lang.String classname)
get the full class name
|
org.apache.hadoop.mapreduce.InputFormat |
getInputFormat() |
org.apache.pig.data.Tuple |
getNext()
get next row
|
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
|
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.ResourceSchema |
getSchema(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
schema: (value, value, value) where keys are in the front.
|
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.hadoop.pig.TableInfo cfDef)
get the validators
|
protected void |
initSchema(java.lang.String signature)
Methods to get the column family schema from Cassandra
|
java.nio.ByteBuffer |
nullToBB() |
protected java.nio.ByteBuffer |
objToBB(java.lang.Object o)
convert object to ByteBuffer
|
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)
output: (((name, value), (name, value)), (value ...
|
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 |
setLocation(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
set read configuration settings
|
void |
setPartitionFilter(org.apache.pig.Expression partitionFilter) |
void |
setStoreFuncUDFContextSignature(java.lang.String signature)
StoreFunc methods
|
void |
setStoreLocation(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
set store configuration settings
|
void |
setUDFContextSignature(java.lang.String signature) |
protected java.lang.String DEFAULT_INPUT_FORMAT
protected java.lang.String DEFAULT_OUTPUT_FORMAT
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 int nativeProtocolVersion
public CqlNativeStorage()
public CqlNativeStorage(int pageSize)
pageSize - limit number of CQL rows to fetch in a thrift requestpublic void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit split)
prepareToRead in class org.apache.pig.LoadFuncpublic void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
prepareToWrite in interface org.apache.pig.StoreFuncInterfacepublic org.apache.pig.data.Tuple getNext()
throws java.io.IOException
getNext in class org.apache.pig.LoadFuncjava.io.IOExceptionprotected org.apache.cassandra.hadoop.pig.TableInfo getCfInfo(java.lang.String signature)
throws java.io.IOException
java.io.IOExceptionprotected com.datastax.driver.core.TableMetadata getCfInfo(com.datastax.driver.core.Session client)
throws com.datastax.driver.core.exceptions.NoHostAvailableException,
AuthenticationException,
java.lang.IllegalStateException
com.datastax.driver.core.exceptions.NoHostAvailableExceptionAuthenticationExceptionjava.lang.IllegalStateExceptionpublic void putNext(org.apache.pig.data.Tuple t)
throws java.io.IOException
putNext in interface org.apache.pig.StoreFuncInterfacejava.io.IOExceptionprotected java.nio.ByteBuffer objToBB(java.lang.Object o)
protected java.util.Map<java.nio.ByteBuffer,AbstractType> getValidatorMap(org.apache.cassandra.hadoop.pig.TableInfo cfDef) throws java.io.IOException
java.io.IOExceptionpublic org.apache.pig.ResourceSchema getSchema(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
getSchema in interface org.apache.pig.LoadMetadatajava.io.IOExceptionpublic void setPartitionFilter(org.apache.pig.Expression partitionFilter)
throws java.io.IOException
setPartitionFilter in interface org.apache.pig.LoadMetadatajava.io.IOExceptionpublic void setLocation(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
setLocation in class org.apache.pig.LoadFuncjava.io.IOExceptionpublic void setStoreLocation(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
setStoreLocation in interface org.apache.pig.StoreFuncInterfacejava.io.IOExceptionprotected void initSchema(java.lang.String signature)
throws java.io.IOException
java.io.IOExceptionprotected static java.lang.String cfdefToString(com.datastax.driver.core.TableMetadata cfDef)
throws java.io.IOException
java.io.IOExceptionprotected static org.apache.cassandra.hadoop.pig.TableInfo cfdefFromString(java.lang.String st)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static java.util.Map<java.lang.String,java.lang.String> getQueryMap(java.lang.String query)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic java.nio.ByteBuffer nullToBB()
public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
throws java.io.IOException
getOutputFormat in interface org.apache.pig.StoreFuncInterfacejava.io.IOExceptionpublic void cleanupOnFailure(java.lang.String failure,
org.apache.hadoop.mapreduce.Job job)
cleanupOnFailure in interface org.apache.pig.StoreFuncInterfacepublic void cleanupOnSuccess(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
cleanupOnSuccess in interface org.apache.pig.StoreFuncInterfacejava.io.IOExceptionpublic java.lang.String[] getPartitionKeys(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
getPartitionKeys in interface org.apache.pig.LoadMetadatajava.io.IOExceptionpublic void checkSchema(org.apache.pig.ResourceSchema schema)
throws java.io.IOException
checkSchema in interface org.apache.pig.StoreFuncInterfacejava.io.IOExceptionpublic org.apache.pig.ResourceStatistics getStatistics(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
getStatistics in interface org.apache.pig.LoadMetadatapublic org.apache.hadoop.mapreduce.InputFormat getInputFormat()
throws java.io.IOException
getInputFormat in class org.apache.pig.LoadFuncjava.io.IOExceptionpublic java.lang.String relToAbsPathForStoreLocation(java.lang.String location,
org.apache.hadoop.fs.Path curDir)
throws java.io.IOException
relToAbsPathForStoreLocation in interface org.apache.pig.StoreFuncInterfacejava.io.IOExceptionpublic java.lang.String relativeToAbsolutePath(java.lang.String location,
org.apache.hadoop.fs.Path curDir)
throws java.io.IOException
relativeToAbsolutePath in class org.apache.pig.LoadFuncjava.io.IOExceptionpublic void setUDFContextSignature(java.lang.String signature)
setUDFContextSignature in class org.apache.pig.LoadFuncpublic void setStoreFuncUDFContextSignature(java.lang.String signature)
setStoreFuncUDFContextSignature in interface org.apache.pig.StoreFuncInterfaceprotected void setConnectionInformation()
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getFullyQualifiedClassName(java.lang.String classname)
Copyright © 2015 The Apache Software Foundation