public class CqlRecordReader
extends org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
implements org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>, java.lang.AutoCloseable
CqlRecordReader reads the rows return from the CQL query It uses CQL auto-paging.
Return a Long as a local CQL row key starts from 0;
Row as C* java driver CQL result set row
1) select clause must include partition key columns (to calculate the progress based on the actual CF row processed)
2) where clause must include token(partition_key1, ... , partition_keyn) > ? and
token(partition_key1, ... , partition_keyn) <= ? (in the right order)
Modifier and Type | Field and Description |
---|---|
protected int |
nativeProtocolVersion |
Constructor and Description |
---|
CqlRecordReader() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.lang.Long |
createKey() |
com.datastax.driver.core.Row |
createValue() |
java.lang.Long |
getCurrentKey() |
com.datastax.driver.core.Row |
getCurrentValue() |
int |
getNativeProtocolVersion()
Return native version protocol of the cluster connection
|
long |
getPos() |
float |
getProgress() |
void |
initialize(org.apache.hadoop.mapreduce.InputSplit split,
org.apache.hadoop.mapreduce.TaskAttemptContext context) |
boolean |
next(java.lang.Long key,
com.datastax.driver.core.Row value) |
boolean |
nextKeyValue() |
public void initialize(org.apache.hadoop.mapreduce.InputSplit split, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws java.io.IOException
initialize
in class org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
java.io.IOException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
close
in class org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
public java.lang.Long getCurrentKey()
getCurrentKey
in class org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
public com.datastax.driver.core.Row getCurrentValue()
getCurrentValue
in class org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
public float getProgress()
getProgress
in interface org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
getProgress
in class org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
public boolean nextKeyValue() throws java.io.IOException
nextKeyValue
in class org.apache.hadoop.mapreduce.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
java.io.IOException
public boolean next(java.lang.Long key, com.datastax.driver.core.Row value) throws java.io.IOException
next
in interface org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
java.io.IOException
public long getPos() throws java.io.IOException
getPos
in interface org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
java.io.IOException
public java.lang.Long createKey()
createKey
in interface org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
public com.datastax.driver.core.Row createValue()
createValue
in interface org.apache.hadoop.mapred.RecordReader<java.lang.Long,com.datastax.driver.core.Row>
public int getNativeProtocolVersion()
Copyright © 2020 The Apache Software Foundation