public static Clustering decodeClustering(CFMetaData metadata, ByteBuffer value) { int csize = metadata.comparator.size(); if (csize == 0) return Clustering.EMPTY; if (metadata.isCompound() && CompositeType.isStaticName(value)) return Clustering.STATIC_CLUSTERING; List<ByteBuffer> components = metadata.isCompound() ? CompositeType.splitName(value) : Collections.singletonList(value); return Clustering.make(components.subList(0, Math.min(csize, components.size())).toArray(new ByteBuffer[csize])); }
public static Clustering decodeClustering(CFMetaData metadata, ByteBuffer value) { int csize = metadata.comparator.size(); if (csize == 0) return Clustering.EMPTY; if (metadata.isCompound() && CompositeType.isStaticName(value)) return Clustering.STATIC_CLUSTERING; List<ByteBuffer> components = metadata.isCompound() ? CompositeType.splitName(value) : Collections.singletonList(value); return Clustering.make(components.subList(0, Math.min(csize, components.size())).toArray(new ByteBuffer[csize])); }
public static Clustering decodeClustering(CFMetaData metadata, ByteBuffer value) { int csize = metadata.comparator.size(); if (csize == 0) return Clustering.EMPTY; if (metadata.isCompound() && CompositeType.isStaticName(value)) return Clustering.STATIC_CLUSTERING; List<ByteBuffer> components = metadata.isCompound() ? CompositeType.splitName(value) : Collections.singletonList(value); return Clustering.make(components.subList(0, Math.min(csize, components.size())).toArray(new ByteBuffer[csize])); }
public static Clustering decodeClustering(CFMetaData metadata, ByteBuffer value) { int csize = metadata.comparator.size(); if (csize == 0) return Clustering.EMPTY; if (metadata.isCompound() && CompositeType.isStaticName(value)) return Clustering.STATIC_CLUSTERING; List<ByteBuffer> components = metadata.isCompound() ? CompositeType.splitName(value) : Collections.singletonList(value); return Clustering.make(components.subList(0, Math.min(csize, components.size())).toArray(new ByteBuffer[csize])); }
public ClusteringPrefix deserialize(DataInputPlus in) throws IOException { // We're reading the old cellname/composite ByteBuffer bb = ByteBufferUtil.readWithShortLength(in); assert bb.hasRemaining(); // empty cellnames were invalid int clusteringSize = metadata.clusteringColumns().size(); // If the table has no clustering column, then the cellname will just be the "column" name, which we ignore here. if (clusteringSize == 0) return Clustering.EMPTY; if (!metadata.isCompound()) return Clustering.make(bb); List<ByteBuffer> components = CompositeType.splitName(bb); byte eoc = CompositeType.lastEOC(bb); if (eoc == 0 || components.size() >= clusteringSize) { // That's a clustering. if (components.size() > clusteringSize) components = components.subList(0, clusteringSize); return Clustering.make(components.toArray(new ByteBuffer[clusteringSize])); } else { // It's a range tombstone bound. It is a start since that's the only part we've ever included // in the index entries. ClusteringPrefix.Kind boundKind = eoc > 0 ? ClusteringPrefix.Kind.EXCL_START_BOUND : ClusteringPrefix.Kind.INCL_START_BOUND; return ClusteringBound.create(boundKind, components.toArray(new ByteBuffer[components.size()])); } }
public ClusteringPrefix deserialize(DataInputPlus in) throws IOException { // We're reading the old cellname/composite ByteBuffer bb = ByteBufferUtil.readWithShortLength(in); assert bb.hasRemaining(); // empty cellnames were invalid int clusteringSize = metadata.clusteringColumns().size(); // If the table has no clustering column, then the cellname will just be the "column" name, which we ignore here. if (clusteringSize == 0) return Clustering.EMPTY; if (!metadata.isCompound()) return Clustering.make(bb); List<ByteBuffer> components = CompositeType.splitName(bb); byte eoc = CompositeType.lastEOC(bb); if (eoc == 0 || components.size() >= clusteringSize) { // That's a clustering. if (components.size() > clusteringSize) components = components.subList(0, clusteringSize); return Clustering.make(components.toArray(new ByteBuffer[clusteringSize])); } else { // It's a range tombstone bound. It is a start since that's the only part we've ever included // in the index entries. ClusteringPrefix.Kind boundKind = eoc > 0 ? ClusteringPrefix.Kind.EXCL_START_BOUND : ClusteringPrefix.Kind.INCL_START_BOUND; return ClusteringBound.create(boundKind, components.toArray(new ByteBuffer[components.size()])); } }
private static Clustering makeCompactClustering(CFMetaData metadata, ByteBuffer name) { assert metadata.isCompactTable(); if (metadata.isCompound()) { List<ByteBuffer> values = CompositeType.splitName(name); return Clustering.make(values.toArray(new ByteBuffer[metadata.comparator.size()])); } else { return Clustering.make(name); } }
public ClusteringPrefix deserialize(DataInputPlus in) throws IOException { // We're reading the old cellname/composite ByteBuffer bb = ByteBufferUtil.readWithShortLength(in); assert bb.hasRemaining(); // empty cellnames were invalid int clusteringSize = metadata.clusteringColumns().size(); // If the table has no clustering column, then the cellname will just be the "column" name, which we ignore here. if (clusteringSize == 0) return Clustering.EMPTY; if (!metadata.isCompound()) return Clustering.make(bb); List<ByteBuffer> components = CompositeType.splitName(bb); byte eoc = CompositeType.lastEOC(bb); if (eoc == 0 || components.size() >= clusteringSize) { // That's a clustering. if (components.size() > clusteringSize) components = components.subList(0, clusteringSize); return Clustering.make(components.toArray(new ByteBuffer[clusteringSize])); } else { // It's a range tombstone bound. It is a start since that's the only part we've ever included // in the index entries. ClusteringPrefix.Kind boundKind = eoc > 0 ? ClusteringPrefix.Kind.EXCL_START_BOUND : ClusteringPrefix.Kind.INCL_START_BOUND; return ClusteringBound.create(boundKind, components.toArray(new ByteBuffer[components.size()])); } }
public ClusteringPrefix deserialize(DataInputPlus in) throws IOException { // We're reading the old cellname/composite ByteBuffer bb = ByteBufferUtil.readWithShortLength(in); assert bb.hasRemaining(); // empty cellnames were invalid int clusteringSize = metadata.clusteringColumns().size(); // If the table has no clustering column, then the cellname will just be the "column" name, which we ignore here. if (clusteringSize == 0) return Clustering.EMPTY; if (!metadata.isCompound()) return Clustering.make(bb); List<ByteBuffer> components = CompositeType.splitName(bb); byte eoc = CompositeType.lastEOC(bb); if (eoc == 0 || components.size() >= clusteringSize) { // That's a clustering. if (components.size() > clusteringSize) components = components.subList(0, clusteringSize); return Clustering.make(components.toArray(new ByteBuffer[clusteringSize])); } else { // It's a range tombstone bound. It is a start since that's the only part we've ever included // in the index entries. ClusteringPrefix.Kind boundKind = eoc > 0 ? ClusteringPrefix.Kind.EXCL_START_BOUND : ClusteringPrefix.Kind.INCL_START_BOUND; return ClusteringBound.create(boundKind, components.toArray(new ByteBuffer[components.size()])); } }
private static Clustering makeCompactClustering(CFMetaData metadata, ByteBuffer name) { assert metadata.isCompactTable(); if (metadata.isCompound()) { List<ByteBuffer> values = CompositeType.splitName(name); return Clustering.make(values.toArray(new ByteBuffer[metadata.comparator.size()])); } else { return Clustering.make(name); } }
private static Clustering makeCompactClustering(CFMetaData metadata, ByteBuffer name) { assert metadata.isCompactTable(); if (metadata.isCompound()) { List<ByteBuffer> values = CompositeType.splitName(name); return Clustering.make(values.toArray(new ByteBuffer[metadata.comparator.size()])); } else { return Clustering.make(name); } }
List<ByteBuffer> components = CompositeType.splitName(bound); byte eoc = CompositeType.lastEOC(bound);
List<ByteBuffer> components = CompositeType.splitName(bound); byte eoc = CompositeType.lastEOC(bound);
List<ByteBuffer> components = CompositeType.splitName(bound); byte eoc = CompositeType.lastEOC(bound);
List<ByteBuffer> components = CompositeType.splitName(bound); byte eoc = CompositeType.lastEOC(bound);