public ByteBuffer primaryKey(ByteBuffer rowKey, CellName clusteringKey) { return primaryKeyType.builder().add(rowKey).add(clusteringKey.toByteBuffer()).build(); }
private void serializeCompound(DataOutputPlus out, boolean isDense) throws IOException { List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(); CompositeType.Builder endBuilder = type.builder(); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); ByteBufferUtil.writeWithShortLength(startBuilder.build(), out); ByteBufferUtil.writeWithShortLength(endBuilder.buildAsEndOfRange(), out); out.writeInt(delTimes[i]); out.writeLong(markedAts[i]); } }
private void serializeCompound(DataOutputPlus out, boolean isDense) throws IOException { List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(start.isStatic); CompositeType.Builder endBuilder = type.builder(end.isStatic); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); ByteBufferUtil.writeWithShortLength(startBuilder.build(), out); ByteBufferUtil.writeWithShortLength(endBuilder.buildAsEndOfRange(), out); out.writeInt(delTimes[i]); out.writeLong(markedAts[i]); } }
private void serializeCompound(DataOutputPlus out, boolean isDense) throws IOException { List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(start.isStatic); CompositeType.Builder endBuilder = type.builder(end.isStatic); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); ByteBufferUtil.writeWithShortLength(startBuilder.build(), out); ByteBufferUtil.writeWithShortLength(endBuilder.buildAsEndOfRange(), out); out.writeInt(delTimes[i]); out.writeLong(markedAts[i]); } }
private long serializedSizeCompound(boolean isDense) { long size = 0; List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < this.size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(); CompositeType.Builder endBuilder = type.builder(); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); size += ByteBufferUtil.serializedSizeWithShortLength(startBuilder.build()); size += ByteBufferUtil.serializedSizeWithShortLength(endBuilder.buildAsEndOfRange()); size += TypeSizes.sizeof(delTimes[i]); size += TypeSizes.sizeof(markedAts[i]); } return size; }
private ByteBuffer defaultPartitionKey() { ByteBuffer partitionKey; AbstractType keyType = table.metadata.getKeyValidator(); if (keyType instanceof CompositeType) { CompositeType compositeType = ((CompositeType) keyType); CompositeType.Builder builder = compositeType.builder(); compositeType.getComponents(); for (AbstractType component : compositeType.getComponents()) { builder.add(Fields.defaultValue(component)); } partitionKey = builder.build(); } else { partitionKey = Fields.defaultValue(keyType); } return partitionKey; }
private void serializeCompound(DataOutputPlus out, boolean isDense) throws IOException { List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(); CompositeType.Builder endBuilder = type.builder(); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); ByteBufferUtil.writeWithShortLength(startBuilder.build(), out); ByteBufferUtil.writeWithShortLength(endBuilder.buildAsEndOfRange(), out); out.writeInt(delTimes[i]); out.writeLong(markedAts[i]); } }
private long serializedSizeCompound(boolean isDense) { long size = 0; List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < this.size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(); CompositeType.Builder endBuilder = type.builder(); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); size += ByteBufferUtil.serializedSizeWithShortLength(startBuilder.build()); size += ByteBufferUtil.serializedSizeWithShortLength(endBuilder.buildAsEndOfRange()); size += TypeSizes.sizeof(delTimes[i]); size += TypeSizes.sizeof(markedAts[i]); } return size; }
private long serializedSizeCompound(boolean isDense) { long size = 0; List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < this.size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(); CompositeType.Builder endBuilder = type.builder(); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); size += ByteBufferUtil.serializedSizeWithShortLength(startBuilder.build()); size += ByteBufferUtil.serializedSizeWithShortLength(endBuilder.buildAsEndOfRange()); size += TypeSizes.sizeof(delTimes[i]); size += TypeSizes.sizeof(markedAts[i]); } return size; }
private long serializedSizeCompound(boolean isDense) { long size = 0; List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); if (!isDense) types.add(UTF8Type.instance); CompositeType type = CompositeType.getInstance(types); for (int i = 0; i < this.size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; CompositeType.Builder startBuilder = type.builder(); CompositeType.Builder endBuilder = type.builder(); for (int j = 0; j < start.bound.clustering().size(); j++) { startBuilder.add(start.bound.get(j)); endBuilder.add(end.bound.get(j)); } if (start.collectionName != null) startBuilder.add(start.collectionName.name.bytes); if (end.collectionName != null) endBuilder.add(end.collectionName.name.bytes); size += ByteBufferUtil.serializedSizeWithShortLength(startBuilder.build()); size += ByteBufferUtil.serializedSizeWithShortLength(endBuilder.buildAsEndOfRange()); size += TypeSizes.sizeof(delTimes[i]); size += TypeSizes.sizeof(markedAts[i]); } return size; }
public static ByteBuffer encodeBound(CFMetaData metadata, ClusteringBound bound, boolean isStart) { if (bound == ClusteringBound.BOTTOM || bound == ClusteringBound.TOP || metadata.comparator.size() == 0) return ByteBufferUtil.EMPTY_BYTE_BUFFER; ClusteringPrefix clustering = bound.clustering(); if (!metadata.isCompound()) { assert clustering.size() == 1; return clustering.get(0); } CompositeType ctype = CompositeType.getInstance(metadata.comparator.subtypes()); CompositeType.Builder builder = ctype.builder(); for (int i = 0; i < clustering.size(); i++) builder.add(clustering.get(i)); if (isStart) return bound.isInclusive() ? builder.build() : builder.buildAsEndOfRange(); else return bound.isInclusive() ? builder.buildAsEndOfRange() : builder.build(); }
public static ByteBuffer encodeBound(CFMetaData metadata, ClusteringBound bound, boolean isStart) { if (bound == ClusteringBound.BOTTOM || bound == ClusteringBound.TOP || metadata.comparator.size() == 0) return ByteBufferUtil.EMPTY_BYTE_BUFFER; ClusteringPrefix clustering = bound.clustering(); if (!metadata.isCompound()) { assert clustering.size() == 1; return clustering.get(0); } CompositeType ctype = CompositeType.getInstance(metadata.comparator.subtypes()); CompositeType.Builder builder = ctype.builder(); for (int i = 0; i < clustering.size(); i++) builder.add(clustering.get(i)); if (isStart) return bound.isInclusive() ? builder.build() : builder.buildAsEndOfRange(); else return bound.isInclusive() ? builder.buildAsEndOfRange() : builder.build(); }
public static ByteBuffer encodeBound(CFMetaData metadata, ClusteringBound bound, boolean isStart) { if (bound == ClusteringBound.BOTTOM || bound == ClusteringBound.TOP || metadata.comparator.size() == 0) return ByteBufferUtil.EMPTY_BYTE_BUFFER; ClusteringPrefix clustering = bound.clustering(); if (!metadata.isCompound()) { assert clustering.size() == 1; return clustering.get(0); } CompositeType ctype = CompositeType.getInstance(metadata.comparator.subtypes()); CompositeType.Builder builder = ctype.builder(); for (int i = 0; i < clustering.size(); i++) builder.add(clustering.get(i)); if (isStart) return bound.isInclusive() ? builder.build() : builder.buildAsEndOfRange(); else return bound.isInclusive() ? builder.buildAsEndOfRange() : builder.build(); }
public static ByteBuffer encodeBound(CFMetaData metadata, ClusteringBound bound, boolean isStart) { if (bound == ClusteringBound.BOTTOM || bound == ClusteringBound.TOP || metadata.comparator.size() == 0) return ByteBufferUtil.EMPTY_BYTE_BUFFER; ClusteringPrefix clustering = bound.clustering(); if (!metadata.isCompound()) { assert clustering.size() == 1; return clustering.get(0); } CompositeType ctype = CompositeType.getInstance(metadata.comparator.subtypes()); CompositeType.Builder builder = ctype.builder(); for (int i = 0; i < clustering.size(); i++) builder.add(clustering.get(i)); if (isStart) return bound.isInclusive() ? builder.build() : builder.buildAsEndOfRange(); else return bound.isInclusive() ? builder.buildAsEndOfRange() : builder.build(); }