You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Matthew F. Dennis (JIRA)" <ji...@apache.org> on 2010/07/07 20:46:51 UTC

[jira] Commented: (CASSANDRA-1154) basic, single node indexing against one indexexpression

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

Matthew F. Dennis commented on CASSANDRA-1154:
----------------------------------------------

+1 but I would replace testIndexScan with:

{code}
@Test
public void testIndexScan() throws IOException
{
    RowMutation rm;

    rm = new RowMutation("Keyspace1", "k1".getBytes());
    rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), new TimestampClock(0));
    rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), new TimestampClock(0));
    rm.apply();

    rm = new RowMutation("Keyspace1", "k2".getBytes());
    rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), new TimestampClock(0));
    rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), new TimestampClock(0));
    rm.apply();

    rm = new RowMutation("Keyspace1", "k3".getBytes());
    rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), new TimestampClock(0));
    rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), new TimestampClock(0));
    rm.apply();

    IndexExpression expr = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(1L));
    IndexClause clause = new IndexClause(Arrays.asList(expr), 100);
    IFilter filter = new IdentityQueryFilter();
    List<Row> rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").scan(clause, filter);

    assert rows != null;
    assert rows.size() == 2;
    assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
    assert Arrays.equals("k3".getBytes(), rows.get(1).key.key);
    assert Arrays.equals(FBUtilities.toByteArray(1L), rows.get(0).cf.getColumn("birthdate".getBytes("UTF8")).value());
    assert Arrays.equals(FBUtilities.toByteArray(1L), rows.get(1).cf.getColumn("birthdate".getBytes("UTF8")).value());
}
{code}


> basic, single node indexing against one indexexpression
> -------------------------------------------------------
>
>                 Key: CASSANDRA-1154
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1154
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: Core
>            Reporter: Jonathan Ellis
>            Assignee: Jonathan Ellis
>             Fix For: 0.7
>
>         Attachments: 1154-v2.txt, 1154.txt
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.