Package org.apache.cassandra.db.composites

Examples of org.apache.cassandra.db.composites.Composite


            return isBeforeSliceStart(column.name());
        }

        protected boolean isBeforeSliceStart(Composite name)
        {
            Composite start = currentStart();
            return !start.isEmpty() && comparator.compare(name, start) < 0;
        }
View Full Code Here


            return !start.isEmpty() && comparator.compare(name, start) < 0;
        }

        protected boolean isColumnBeforeSliceFinish(OnDiskAtom column)
        {
            Composite finish = currentFinish();
            return finish.isEmpty() || comparator.compare(column.name(), finish) <= 0;
        }
View Full Code Here

            return finish.isEmpty() || comparator.compare(column.name(), finish) <= 0;
        }

        protected boolean isAfterSliceFinish(Composite name)
        {
            Composite finish = currentFinish();
            return !finish.isEmpty() && comparator.compare(name, finish) > 0;
        }
View Full Code Here

            // scan from index start
            while (file.bytesPastMark(mark) < currentIndex.width || deserializer.hasUnprocessed())
            {
                // col is before slice
                // (If in slice, don't bother checking that until we change slice)
                Composite start = currentStart();
                if (!inSlice && !start.isEmpty() && deserializer.compareNextTo(start) < 0)
                {
                    if (reversed)
                    {
                        // the next slice select columns that are before the current one, so it may
                        // match this column, so keep it around.
                        prefetched.addFirst(deserializer.readNext());
                    }
                    else
                    {
                        deserializer.skipNext();
                    }
                }
                // col is within slice
                else
                {
                    Composite finish = currentFinish();
                    if (finish.isEmpty() || deserializer.compareNextTo(finish) <= 0)
                    {
                        inSlice = true;
                        addColumn(deserializer.readNext());
                    }
                    // col is after slice.
View Full Code Here

            AtomDeserializer deserializer = emptyColumnFamily.metadata().getOnDiskDeserializer(file, sstable.descriptor.version);
            while (deserializer.hasNext())
            {
                // col is before slice
                // (If in slice, don't bother checking that until we change slice)
                Composite start = currentStart();
                if (!inSlice && !start.isEmpty() && deserializer.compareNextTo(start) < 0)
                {
                    deserializer.skipNext();
                    continue;
                }

                // col is within slice
                Composite finish = currentFinish();
                if (finish.isEmpty() || deserializer.compareNextTo(finish) <= 0)
                {
                    inSlice = true;
                    addColumn(deserializer.readNext());
                }
                // col is after slice. more slices?
View Full Code Here

     */
    public static Row readSchemaRow(String schemaCfName, String ksName, String cfName)
    {
        DecoratedKey key = StorageService.getPartitioner().decorateKey(getSchemaKSKey(ksName));
        ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(schemaCfName);
        Composite prefix = schemaCFS.getComparator().make(cfName);
        ColumnFamily cf = schemaCFS.getColumnFamily(key,
                                                    prefix,
                                                    prefix.end(),
                                                    false,
                                                    Integer.MAX_VALUE,
                                                    System.currentTimeMillis());
        return new Row(key, cf);
    }
View Full Code Here

        return new MessageOut<>(MessagingService.Verb.PAGED_RANGE, this, serializer);
    }

    public AbstractRangeCommand forSubRange(AbstractBounds<RowPosition> subRange)
    {
        Composite newStart = subRange.left.equals(keyRange.left) ? start : ((SliceQueryFilter)predicate).start();
        Composite newStop = subRange.right.equals(keyRange.right) ? stop : ((SliceQueryFilter)predicate).finish();
        return new PagedRangeCommand(keyspace,
                                     columnFamily,
                                     timestamp,
                                     subRange,
                                     (SliceQueryFilter)predicate,
View Full Code Here

            CFMetaData metadata = Schema.instance.getCFMetaData(keyspace, columnFamily);

            SliceQueryFilter predicate = metadata.comparator.sliceQueryFilterSerializer().deserialize(in, version);

            Composite start = metadata.comparator.serializer().deserialize(in);
            Composite stop =  metadata.comparator.serializer().deserialize(in);

            int filterCount = in.readInt();
            List<IndexExpression> rowFilter = new ArrayList<IndexExpression>(filterCount);
            for (int i = 0; i < filterCount; i++)
            {
View Full Code Here

            return true;

        if (start().isEmpty() || finish().isEmpty() || !cf.hasColumns())
            return false;

        Composite low = isReversed() ? finish() : start();
        Composite high = isReversed() ? start() : finish();

        CellName first = cf.iterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name();
        CellName last = cf.reverseIterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name();

        return cf.getComparator().compare(first, low) <= 0
View Full Code Here

     *               sort order, not our sort order), to normalise to our sort order, and a backwards iterator is returned
     * @param iter   If this slice is part of a multi-slice, the iterator will be updated to ensure cells are visited only once
     */
    private Iterator<Cell> slice(ColumnSlice slice, boolean invert, SlicesIterator iter)
    {
        Composite start = invert ? slice.finish : slice.start;
        Composite finish = invert ? slice.start : slice.finish;

        int lowerBound = 0, upperBound = size;
        if (iter != null)
        {
            if (invert)
                upperBound = iter.previousSliceEnd;
            else
                lowerBound = iter.previousSliceEnd;
        }

        if (!start.isEmpty())
        {
            lowerBound = binarySearch(lowerBound, upperBound, start, internalComparator());
            if (lowerBound < 0)
                lowerBound = -lowerBound - 1;
        }

        if (!finish.isEmpty())
        {
            upperBound = binarySearch(lowerBound, upperBound, finish, internalComparator());
            upperBound = upperBound < 0
                       ? -upperBound - 1
                       : upperBound + 1; // upperBound is exclusive for the iterators
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.composites.Composite

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.