protected ColumnNameBuilder makeIndexColumnNameBuilder(ByteBuffer rowKey, ByteBuffer columnName) { int ckCount = baseCfs.metadata.clusteringKeyColumns().size(); CompositeType baseComparator = (CompositeType) baseCfs.getComparator(); ByteBuffer[] components = baseComparator.split(columnName); CompositeType.Builder builder = getIndexComparator().builder(); builder.add(rowKey); for (int i = 0; i < ckCount; i++) builder.add(components[i]); return builder; }
public static CompositeType buildIndexComparator( CFMetaData baseMetadata, ColumnDefinition columnDef) { int ckCount = baseMetadata.clusteringKeyColumns().size(); List<AbstractType<?>> types = new ArrayList<AbstractType<?>>(ckCount + 1); types.add(SecondaryIndex.keyComparator); types.addAll(baseMetadata.comparator.getComponents()); return CompositeType.getInstance(types); }
protected ByteBuffer getIndexedValue(ByteBuffer rowKey, Column column) { CompositeType keyComparator = (CompositeType) baseCfs.metadata.getKeyValidator(); ByteBuffer[] components = keyComparator.split(rowKey); return components[columnDef.componentIndex]; }