public class CqlRecordReader extends org.apache.hadoop.mapreduce.RecordReader<Long,com.datastax.driver.core.Row> implements org.apache.hadoop.mapred.RecordReader<Long,com.datastax.driver.core.Row>, 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() |
Long |
createKey() |
com.datastax.driver.core.Row |
createValue() |
Long |
getCurrentKey() |
com.datastax.driver.core.Row |
getCurrentValue() |
long |
getPos() |
float |
getProgress() |
void |
initialize(org.apache.hadoop.mapreduce.InputSplit split,
org.apache.hadoop.mapreduce.TaskAttemptContext context) |
boolean |
next(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 IOException
initialize in class org.apache.hadoop.mapreduce.RecordReader<Long,com.datastax.driver.core.Row>IOExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface org.apache.hadoop.mapred.RecordReader<Long,com.datastax.driver.core.Row>close in class org.apache.hadoop.mapreduce.RecordReader<Long,com.datastax.driver.core.Row>public Long getCurrentKey()
getCurrentKey in class org.apache.hadoop.mapreduce.RecordReader<Long,com.datastax.driver.core.Row>public com.datastax.driver.core.Row getCurrentValue()
getCurrentValue in class org.apache.hadoop.mapreduce.RecordReader<Long,com.datastax.driver.core.Row>public float getProgress()
public boolean nextKeyValue()
throws IOException
nextKeyValue in class org.apache.hadoop.mapreduce.RecordReader<Long,com.datastax.driver.core.Row>IOExceptionpublic boolean next(Long key, com.datastax.driver.core.Row value) throws IOException
next in interface org.apache.hadoop.mapred.RecordReader<Long,com.datastax.driver.core.Row>IOExceptionpublic long getPos()
getPos in interface org.apache.hadoop.mapred.RecordReader<Long,com.datastax.driver.core.Row>public Long createKey()
createKey in interface org.apache.hadoop.mapred.RecordReader<Long,com.datastax.driver.core.Row>public com.datastax.driver.core.Row createValue()
createValue in interface org.apache.hadoop.mapred.RecordReader<Long,com.datastax.driver.core.Row>Copyright © 2012–2024. All rights reserved.