Examples of IdentityQueryFilter


Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

            IPartitioner p = StorageService.getPartitioner();
            IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"),
                                                       IndexOperator.EQ,
                                                       ByteBufferUtil.bytes(val));
            List<IndexExpression> clause = Arrays.asList(expr);
            IDiskAtomFilter filter = new IdentityQueryFilter();
            Range<RowPosition> range = Util.range("", "");
            List<Row> rows = cfs.search(clause, range, 100, filter);
            assertEquals(1, rows.size());
            assert rows.get(0).key.key.equals(ByteBufferUtil.bytes(key));
        }
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        rm.apply();

        // basic single-expression query
        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(expr);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        IPartitioner p = StorageService.getPartitioner();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").search(clause, range, 100, filter);

        assert rows != null;
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        }

        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(34L));
        IndexExpression expr2 = new IndexExpression(ByteBufferUtil.bytes("notbirthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(expr, expr2);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        IPartitioner p = StorageService.getPartitioner();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").search(clause, range, 100, filter);

        assert rows != null;
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(1L), 0);
        rm.apply();

        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(expr);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        IPartitioner p = StorageService.getPartitioner();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = cfs.search(clause, range, 100, filter);
        assert rows.size() == 1 : StringUtils.join(rows, ",");
        String key = ByteBufferUtil.string(rows.get(0).key.key);
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(2L), 2);
        rm.apply();

        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(expr);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        IPartitioner p = StorageService.getPartitioner();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = table.getColumnFamilyStore("Indexed1").search(clause, range, 100, filter);
        assert rows.size() == 0;
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        rm = new RowMutation(keySpace, rowKey);
        rm.add(new QueryPath(cfName, null, colName), val1, 0);
        rm.apply();
        IndexExpression expr = new IndexExpression(colName, IndexOperator.EQ, val1);
        List<IndexExpression> clause = Arrays.asList(expr);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(1, rows.size());

        // force a flush, so our index isn't being read from a memtable
        table.getColumnFamilyStore(cfName).forceBlockingFlush();

        // now apply another update, but force the index update to be skipped
        rm = new RowMutation(keySpace, rowKey);
        rm.add(new QueryPath(cfName, null, colName), val2, 1);
        table.apply(rm, true, false);

        // Now searching the index for either the old or new value should return 0 rows
        // because the new value was not indexed and the old value should be ignored
        // (and in fact purged from the index cf).
        // first check for the old value
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(0, rows.size());
        // now check for the updated value
        expr = new IndexExpression(colName, IndexOperator.EQ, val2);
        clause = Arrays.asList(expr);
        filter = new IdentityQueryFilter();
        range = Util.range("", "");
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(0, rows.size());

        // now, reset back to the original value, still skipping the index update, to
        // make sure the value was expunged from the index when it was discovered to be inconsistent
        rm = new RowMutation(keySpace, rowKey);
        rm.add(new QueryPath(cfName, null, colName), ByteBufferUtil.bytes(1L), 3);
        table.apply(rm, true, false);

        expr = new IndexExpression(colName, IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        clause = Arrays.asList(expr);
        filter = new IdentityQueryFilter();
        range = Util.range("", "");
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(0, rows.size());
    }
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        rm.apply();

        // test that the index query fetches this version
        IndexExpression expr = new IndexExpression(colName, IndexOperator.EQ, val1);
        List<IndexExpression> clause = Arrays.asList(expr);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(1, rows.size());

        // force a flush and retry the query, so our index isn't being read from a memtable
        table.getColumnFamilyStore(cfName).forceBlockingFlush();
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(1, rows.size());

        // now apply another update, but force the index update to be skipped
        rm = new RowMutation(keySpace, rowKey);
        rm.add(new QueryPath(cfName, null, compositeName), val2, 1);
        table.apply(rm, true, false);

        // Now searching the index for either the old or new value should return 0 rows
        // because the new value was not indexed and the old value should be ignored
        // (and in fact purged from the index cf).
        // first check for the old value
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(0, rows.size());
        // now check for the updated value
        expr = new IndexExpression(colName, IndexOperator.EQ, val2);
        clause = Arrays.asList(expr);
        filter = new IdentityQueryFilter();
        range = Util.range("", "");
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(0, rows.size());

        // now, reset back to the original value, still skipping the index update, to
        // make sure the value was expunged from the index when it was discovered to be inconsistent
        rm = new RowMutation(keySpace, rowKey);
        rm.add(new QueryPath(cfName, null , compositeName), val1, 2);
        table.apply(rm, true, false);

        expr = new IndexExpression(colName, IndexOperator.EQ, val1);
        clause = Arrays.asList(expr);
        filter = new IdentityQueryFilter();
        range = Util.range("", "");
        rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
        assertEquals(0, rows.size());
    }
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        // basic single-expression query
        IndexExpression expr1 = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        IndexExpression expr2 = new IndexExpression(ByteBufferUtil.bytes("notbirthdate"), IndexOperator.GT, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(new IndexExpression[]{ expr1, expr2 });
        IDiskAtomFilter filter = new IdentityQueryFilter();
        IPartitioner p = StorageService.getPartitioner();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").search(clause, range, 1, filter);

        assert rows != null;
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

    private void queryBirthdate(Table table) throws CharacterCodingException
    {
        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(expr);
        IDiskAtomFilter filter = new IdentityQueryFilter();
        IPartitioner p = StorageService.getPartitioner();
        List<Row> rows = table.getColumnFamilyStore("Indexed2").search(clause, Util.range("", ""), 100, filter);
        assert rows.size() == 1 : StringUtils.join(rows, ",");
        assertEquals("k1", ByteBufferUtil.string(rows.get(0).key.key));
    }
View Full Code Here

Examples of org.apache.cassandra.db.columniterator.IdentityQueryFilter

        store.forceBlockingFlush();

        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, LongType.instance.decompose(1L));
        // explicitly tell to the KeysSearcher to use column limiting for rowsPerQuery to trigger bogus columnsRead--; (CASSANDRA-3996)
        List<Row> rows = store.search(Arrays.asList(expr), Util.range("", ""), 10, new IdentityQueryFilter(), true);

        assert rows.size() == 10;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.