cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew F. Dennis (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CASSANDRA-1154) basic, single node indexing against one indexexpression
Date Wed, 07 Jul 2010 18:46:51 GMT

    [ 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.


Mime
View raw message