private static List<ColumnDef> columnDefinitionsToThrift(CFMetaData metadata, Collection<ColumnDefinition> columns) { List<ColumnDef> thriftDefs = new ArrayList<>(columns.size()); for (ColumnDefinition def : columns) if (def.isPartOfCellName(metadata.isCQLTable(), metadata.isSuper())) thriftDefs.add(ThriftConversion.toThrift(metadata, def)); return thriftDefs; }
public AbstractType<?> getColumnDefinitionNameComparator(ColumnDefinition.Kind kind) { return (isSuper() && kind == ColumnDefinition.Kind.REGULAR) || (isStaticCompactTable() && kind == ColumnDefinition.Kind.STATIC) ? thriftColumnNameType() : UTF8Type.instance; }
public AbstractType<?> getColumnDefinitionNameComparator(ColumnDefinition.Kind kind) { return (isSuper() && kind == ColumnDefinition.Kind.REGULAR) || (isStaticCompactTable() && kind == ColumnDefinition.Kind.STATIC) ? thriftColumnNameType() : UTF8Type.instance; }
public AbstractType<?> thriftColumnNameType() { if (isSuper()) { ColumnDefinition def = compactValueColumn(); assert def != null && def.type instanceof MapType; return ((MapType)def.type).nameComparator(); } assert isStaticCompactTable(); return clusteringColumns.get(0).type; }
public static UnfilteredPartitionIterator maybeWrap(UnfilteredPartitionIterator iterator, CFMetaData metadata, int nowInSec) { if (!metadata.isStaticCompactTable() && !metadata.isSuper()) return iterator; return Transformation.apply(iterator, new ThriftResultsMerger(nowInSec)); }
public static LegacyCellName decodeCellName(CFMetaData metadata, ByteBuffer superColumnName, ByteBuffer cellname) throws UnknownColumnException { assert cellname != null; if (metadata.isSuper()) { assert superColumnName != null; return decodeForSuperColumn(metadata, Clustering.make(superColumnName), cellname); } assert superColumnName == null; return decodeCellName(metadata, cellname); }
public static LegacyCellName decodeCellName(CFMetaData metadata, ByteBuffer superColumnName, ByteBuffer cellname) throws UnknownColumnException { assert cellname != null; if (metadata.isSuper()) { assert superColumnName != null; return decodeForSuperColumn(metadata, Clustering.make(superColumnName), cellname); } assert superColumnName == null; return decodeCellName(metadata, cellname); }
public SuperColumnCompatibility.SuperColumnRestrictions getSuperColumnRestrictions() { assert cfm.isSuper() && cfm.isDense(); if (cached == null) cached = new SuperColumnCompatibility.SuperColumnRestrictions(Iterators.concat(clusteringColumnsRestrictions.iterator(), nonPrimaryKeyRestrictions.iterator())); return cached; } }
public static UnfilteredRowIterator maybeWrap(UnfilteredRowIterator iterator, int nowInSec) { if (!iterator.metadata().isStaticCompactTable() && !iterator.metadata().isSuper()) return iterator; return iterator.metadata().isSuper() ? Transformation.apply(iterator, new SuperColumnsPartitionMerger(iterator, nowInSec)) : new PartitionMerger(iterator, nowInSec); }
@Override protected Restriction newEQRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException { assert cfm.isSuper() && cfm.isDense(); List<ColumnDefinition> receivers = receivers(cfm); Term term = toTerm(receivers, getValue(), cfm.ksName, boundNames); return new SingleColumnRestriction.SuperColumnMultiEQRestriction(receivers.get(0), term); }
@Override protected Restriction newSliceRestriction(CFMetaData cfm, VariableSpecifications boundNames, Bound bound, boolean inclusive) throws InvalidRequestException { assert cfm.isSuper() && cfm.isDense(); List<ColumnDefinition> receivers = receivers(cfm); Term term = toTerm(receivers, getValue(), cfm.ksName, boundNames); return new SingleColumnRestriction.SuperColumnMultiSliceRestriction(receivers.get(0), bound, inclusive, term); }
@Override protected Restriction newSliceRestriction(CFMetaData cfm, VariableSpecifications boundNames, Bound bound, boolean inclusive) throws InvalidRequestException { assert cfm.isSuper() && cfm.isDense(); List<ColumnDefinition> receivers = receivers(cfm); Term term = toTerm(receivers, getValue(), cfm.ksName, boundNames); return new SingleColumnRestriction.SuperColumnMultiSliceRestriction(receivers.get(0), bound, inclusive, term); }
@Override public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator iter) { return iter.metadata().isSuper() ? Transformation.apply(iter, new SuperColumnsPartitionMerger(iter, nowInSec)) : new PartitionMerger(iter, nowInSec); }
public SuperColumnCompatibility.SuperColumnRestrictions getSuperColumnRestrictions() { assert cfm.isSuper() && cfm.isDense(); if (cached == null) cached = new SuperColumnCompatibility.SuperColumnRestrictions(Iterators.concat(clusteringColumnsRestrictions.iterator(), nonPrimaryKeyRestrictions.iterator())); return cached; } }
public AbstractType<?> makeLegacyDefaultValidator() { if (isCounter()) return CounterColumnType.instance; else if (isCompactTable()) return isSuper() ? ((MapType)compactValueColumn().type).valueComparator() : compactValueColumn().type; else return BytesType.instance; }
private SuperColumnsPartitionMerger(UnfilteredRowIterator applyTo, int nowInSec) { assert applyTo.metadata().isSuper(); this.nowInSec = nowInSec; this.superColumnMapColumn = applyTo.metadata().compactValueColumn(); assert superColumnMapColumn != null && superColumnMapColumn.type instanceof MapType; this.builder = BTreeRow.sortedBuilder(); this.columnComparator = ((MapType)superColumnMapColumn.type).nameComparator(); }
public AbstractType<?> makeLegacyDefaultValidator() { if (isCounter()) return CounterColumnType.instance; else if (isCompactTable()) return isSuper() ? ((MapType)compactValueColumn().type).valueComparator() : compactValueColumn().type; else return BytesType.instance; }
public void addRowDeletion() { // For compact tables, at the exclusion of the static row (of static compact tables), each row ever has a single column, // the "compact" one. As such, deleting the row or deleting that single cell is equivalent. We favor the later however // because that makes it easier when translating back to the old format layout (for thrift and pre-3.0 backward // compatibility) as we don't have to special case for the row deletion. This is also in line with what we used to do pre-3.0. if (metadata.isCompactTable() && builder.clustering() != Clustering.STATIC_CLUSTERING && !metadata.isSuper()) addTombstone(metadata.compactValueColumn()); else builder.addRowDeletion(Row.Deletion.regular(deletionTime)); }
public void addRowDeletion() { // For compact tables, at the exclusion of the static row (of static compact tables), each row ever has a single column, // the "compact" one. As such, deleting the row or deleting that single cell is equivalent. We favor the later however // because that makes it easier when translating back to the old format layout (for thrift and pre-3.0 backward // compatibility) as we don't have to special case for the row deletion. This is also in line with what we used to do pre-3.0. if (metadata.isCompactTable() && builder.clustering() != Clustering.STATIC_CLUSTERING && !metadata.isSuper()) addTombstone(metadata.compactValueColumn()); else builder.addRowDeletion(Row.Deletion.regular(deletionTime)); }
private ClusteringIndexFilter toInternalFilter(CFMetaData metadata, ColumnParent parent, SliceRange range) { if (metadata.isSuper() && parent.isSetSuper_column()) return new ClusteringIndexNamesFilter(FBUtilities.singleton(Clustering.make(parent.bufferForSuper_column()), metadata.comparator), range.reversed); else return new ClusteringIndexSliceFilter(makeSlices(metadata, range), range.reversed); }