Package org.apache.cassandra.db.filter

Examples of org.apache.cassandra.db.filter.ColumnCounter


        return metadata.cfType;
    }

    public int liveCQL3RowCount(long now)
    {
        ColumnCounter counter = getComparator().isDense()
                              ? new ColumnCounter(now)
                              : new ColumnCounter.GroupByPrefix(now, getComparator(), metadata.clusteringColumns().size());
        return counter.countAll(this).live();
    }
View Full Code Here


             : discardTail(cf, toDiscard, newCf, cf.iterator(), tester);
    }

    private int discardHead(ColumnFamily cf, int toDiscard, ColumnFamily copy, Iterator<Column> iter, DeletionInfo.InOrderTester tester)
    {
        ColumnCounter counter = columnCounter();

        // Discard the first 'toDiscard' live
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > toDiscard)
            {
                copy.addColumn(c);
                while (iter.hasNext())
                    copy.addColumn(iter.next());
            }
        }
        return Math.min(counter.live(), toDiscard);
    }
View Full Code Here

        // Redoing the counting like that is not extremely efficient.
        // This is called only for reversed slices or in the case of a race between
        // paging and a deletion (pretty unlikely), so this is probably acceptable.
        int liveCount = columnCounter().countAll(cf).live();

        ColumnCounter counter = columnCounter();
        // Discard the last 'toDiscard' live (so stop adding as sound as we're past 'liveCount - toDiscard')
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > liveCount - toDiscard)
                break;

            copy.addColumn(c);
        }
        return Math.min(liveCount, toDiscard);
View Full Code Here

        return metadata.cfType;
    }

    public int liveCQL3RowCount(long now)
    {
        ColumnCounter counter = getComparator().isDense()
                              ? new ColumnCounter(now)
                              : new ColumnCounter.GroupByPrefix(now, getComparator(), metadata.clusteringColumns().size());
        return counter.countAll(this).live();
    }
View Full Code Here

                                 long now) throws RequestValidationException, RequestExecutionException
    {
        SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
        final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);

        ColumnCounter counter = filter.columnCounter(Schema.instance.getComparator(keyspace, columnFamily), now);
        while (!pager.isExhausted())
        {
            List<Row> next = pager.fetchPage(pageSize);
            if (!next.isEmpty())
                counter.countAll(next.get(0).cf);
        }
        return counter.live();
    }
View Full Code Here

             : discardTail(cf, toDiscard, newCf, cf.iterator(), tester);
    }

    private int discardHead(ColumnFamily cf, int toDiscard, ColumnFamily copy, Iterator<Column> iter, DeletionInfo.InOrderTester tester)
    {
        ColumnCounter counter = columnCounter();

        // Discard the first 'toDiscard' live
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > toDiscard)
            {
                copy.addColumn(c);
                while (iter.hasNext())
                    copy.addColumn(iter.next());
            }
        }
        return Math.min(counter.live(), toDiscard);
    }
View Full Code Here

        // Redoing the counting like that is not extremely efficient.
        // This is called only for reversed slices or in the case of a race between
        // paging and a deletion (pretty unlikely), so this is probably acceptable.
        int liveCount = columnCounter().countAll(cf).live();

        ColumnCounter counter = columnCounter();
        // Discard the last 'toDiscard' live (so stop adding as sound as we're past 'liveCount - toDiscard')
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > liveCount - toDiscard)
                break;

            copy.addColumn(c);
        }
        return Math.min(liveCount, toDiscard);
View Full Code Here

                                 long now) throws RequestValidationException, RequestExecutionException
    {
        SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
        final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);

        ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now);
        while (!pager.isExhausted())
        {
            List<Row> next = pager.fetchPage(pageSize);
            if (!next.isEmpty())
                counter.countAll(next.get(0).cf);
        }
        return counter.live();
    }
View Full Code Here

        }

        @Override
        public ColumnCounter columnCounter()
        {
            return new ColumnCounter(0);
        }
View Full Code Here

             : discardTail(cf, toDiscard, newCf, cf.iterator(), tester);
    }

    private int discardHead(ColumnFamily cf, int toDiscard, ColumnFamily copy, Iterator<Cell> iter, DeletionInfo.InOrderTester tester)
    {
        ColumnCounter counter = columnCounter();

        // Discard the first 'toDiscard' live
        while (iter.hasNext())
        {
            Cell c = iter.next();
            counter.count(c, tester);
            if (counter.live() > toDiscard)
            {
                copy.addColumn(c);
                while (iter.hasNext())
                    copy.addColumn(iter.next());
            }
        }
        return Math.min(counter.live(), toDiscard);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.filter.ColumnCounter

Copyright © 2018 www.massapicom. 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.