[ 
https://issues.apache.org/jira/browse/CASSANDRA-6311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13946681#comment-13946681
 ] 

Alex Liu commented on CASSANDRA-6311:
-------------------------------------

public boolean next(Long key, Row value) throws IOException signature is fine.

The problem is Old Hadoop uses
{code}
    public Long createKey()
    public Row createValue()
{code}
to create key and value object, then use 
{code}
public boolean next(Long key, Row value)
{code}
to set the properties of the key, and value objects

Because of Long is wrapper of long, there is no way to set long value of key. 
But since it's row count number, it's not useful anyway, so we can ignore it.
But Row is backed by ArrayBackedRow, a protected class of Cassandra java 
driver. It has two properties, 
{code}
    private final ColumnDefinitions metadata;
    private final List<ByteBuffer> data;
{code}
Which should be opened up, so the properties can be set. Also it's a protected 
class, it should be made to public.
The fix looks like
{code}
    public Row createValue()
    {
        return new ArrayBackedRow(null, null);
    }

    public boolean next(Long key, Row value) throws IOException
    {
        if (nextKeyValue())
        {
            
value.setColumnDefinitions(getCurrentValue().getColumnDefinitions());
            value.setData(getCurrentValue().getData());
            return true;
        }
        return false;
    }
{code}

> Add CqlRecordReader to take advantage of native CQL pagination
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-6311
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6311
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Hadoop
>            Reporter: Alex Liu
>            Assignee: Alex Liu
>             Fix For: 2.0.7
>
>         Attachments: 6311-v10.txt, 6311-v3-2.0-branch.txt, 6311-v4.txt, 
> 6311-v5-2.0-branch.txt, 6311-v6-2.0-branch.txt, 6311-v7.txt, 6311-v8.txt, 
> 6311-v9.txt, 6331-2.0-branch.txt, 6331-v2-2.0-branch.txt
>
>
> Since the latest Cql pagination is done and it should be more efficient, so 
> we need update CqlPagingRecordReader to use it instead of the custom thrift 
> paging.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to