/** * Find a SuperColumn value column if it's available (for example, when it was renamed) or create one with a default name. */ public static ColumnDefinition getSuperCfValueColumn(CFMetaData cfm, PartitionColumns partitionColumns, ColumnDefinition superCfKeyColumn, CompactTables.DefaultNames defaultNames) { assert cfm.isDense(); MapType mapType = (MapType) cfm.compactValueColumn().type; for (ColumnDefinition def: partitionColumns.regulars) { if (!def.name.bytes.equals(SUPER_COLUMN_MAP_COLUMN) && def.type.equals(mapType.getValuesType()) && !def.equals(superCfKeyColumn)) return def; } ColumnIdentifier identifier = ColumnIdentifier.getInterned(defaultNames.defaultCompactValueName(), true); return new ColumnDefinition(cfm.ksName, cfm.cfName, identifier, mapType.getValuesType(), ColumnDefinition.NO_POSITION, ColumnDefinition.Kind.REGULAR); }
/** * Find a SuperColumn value column if it's available (for example, when it was renamed) or create one with a default name. */ public static ColumnDefinition getSuperCfValueColumn(CFMetaData cfm, PartitionColumns partitionColumns, ColumnDefinition superCfKeyColumn, CompactTables.DefaultNames defaultNames) { assert cfm.isDense(); MapType mapType = (MapType) cfm.compactValueColumn().type; for (ColumnDefinition def: partitionColumns.regulars) { if (!def.name.bytes.equals(SUPER_COLUMN_MAP_COLUMN) && def.type.equals(mapType.getValuesType()) && !def.equals(superCfKeyColumn)) return def; } ColumnIdentifier identifier = ColumnIdentifier.getInterned(defaultNames.defaultCompactValueName(), true); return new ColumnDefinition(cfm.ksName, cfm.cfName, identifier, mapType.getValuesType(), ColumnDefinition.NO_POSITION, ColumnDefinition.Kind.REGULAR); }
/** * Find a SuperColumn value column if it's available (for example, when it was renamed) or create one with a default name. */ public static ColumnDefinition getSuperCfValueColumn(CFMetaData cfm, PartitionColumns partitionColumns, ColumnDefinition superCfKeyColumn, CompactTables.DefaultNames defaultNames) { assert cfm.isDense(); MapType mapType = (MapType) cfm.compactValueColumn().type; for (ColumnDefinition def: partitionColumns.regulars) { if (!def.name.bytes.equals(SUPER_COLUMN_MAP_COLUMN) && def.type.equals(mapType.getValuesType()) && !def.equals(superCfKeyColumn)) return def; } ColumnIdentifier identifier = ColumnIdentifier.getInterned(defaultNames.defaultCompactValueName(), true); return new ColumnDefinition(cfm.ksName, cfm.cfName, identifier, mapType.getValuesType(), ColumnDefinition.NO_POSITION, ColumnDefinition.Kind.REGULAR); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof ComplexColumnData)) return false; ComplexColumnData that = (ComplexColumnData)other; return this.column().equals(that.column()) && this.complexDeletion().equals(that.complexDeletion) && BTree.equals(this.cells, that.cells); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof ComplexColumnData)) return false; ComplexColumnData that = (ComplexColumnData)other; return this.column().equals(that.column()) && this.complexDeletion().equals(that.complexDeletion) && BTree.equals(this.cells, that.cells); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof ComplexColumnData)) return false; ComplexColumnData that = (ComplexColumnData)other; return this.column().equals(that.column()) && this.complexDeletion().equals(that.complexDeletion) && BTree.equals(this.cells, that.cells); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof ComplexColumnData)) return false; ComplexColumnData that = (ComplexColumnData)other; return this.column().equals(that.column()) && this.complexDeletion().equals(that.complexDeletion) && BTree.equals(this.cells, that.cells); }
if (target.left.equals(column))
if (target.left.equals(column))
if (pkColumn.equals(def)) break;
if (pkColumn.equals(def)) break;
/** * Checks that the column identifiers used as argument for the token function have been specified in the * partition key order. * @param cfm the Column Family MetaData * @throws InvalidRequestException if the arguments have not been provided in the proper order. */ private void checkTokenFunctionArgumentsOrder(CFMetaData cfm) throws InvalidRequestException { Iterator<ColumnDefinition> iter = Iterators.cycle(cfm.partitionKeyColumns()); for (Relation relation : whereClause) { if (!relation.isOnToken()) continue; assert !relation.isMultiColumn() : "Unexpectedly got multi-column token relation"; SingleColumnRelation singleColumnRelation = (SingleColumnRelation) relation; if (!cfm.getColumnDefinition(singleColumnRelation.getEntity().prepare(cfm)).equals(iter.next())) throw new InvalidRequestException(String.format("The token function arguments must be in the partition key order: %s", Joiner.on(',').join(cfm.partitionKeyColumns()))); } }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof Cell)) return false; Cell that = (Cell)other; return this.column().equals(that.column()) && this.isCounterCell() == that.isCounterCell() && this.timestamp() == that.timestamp() && this.ttl() == that.ttl() && this.localDeletionTime() == that.localDeletionTime() && Objects.equals(this.value(), that.value()) && Objects.equals(this.path(), that.path()); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof Cell)) return false; Cell that = (Cell)other; return this.column().equals(that.column()) && this.isCounterCell() == that.isCounterCell() && this.timestamp() == that.timestamp() && this.ttl() == that.ttl() && this.localDeletionTime() == that.localDeletionTime() && Objects.equals(this.value(), that.value()) && Objects.equals(this.path(), that.path()); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof Cell)) return false; Cell that = (Cell)other; return this.column().equals(that.column()) && this.isCounterCell() == that.isCounterCell() && this.timestamp() == that.timestamp() && this.ttl() == that.ttl() && this.localDeletionTime() == that.localDeletionTime() && Objects.equals(this.value(), that.value()) && Objects.equals(this.path(), that.path()); }
@Override public boolean equals(Object other) { if (this == other) return true; if(!(other instanceof Cell)) return false; Cell that = (Cell)other; return this.column().equals(that.column()) && this.isCounterCell() == that.isCounterCell() && this.timestamp() == that.timestamp() && this.ttl() == that.ttl() && this.localDeletionTime() == that.localDeletionTime() && Objects.equals(this.value(), that.value()) && Objects.equals(this.path(), that.path()); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
public Row getRowWithMetaColumn(ByteBuffer metaColumnValue) { if (isMetaColumn) { ColumnFamily cleanColumnFamily = ArrayBackedSortedColumns.factory.create(table.metadata); CellNameType cellNameType = table.getComparator(); boolean hasCollections = cellNameType.hasCollections(); int prefixSize = cellNameType.size() - (hasCollections ? 2 : 1); CBuilder builder = cellNameType.builder(); for (int i = 0; i < prefixSize; i++) { AbstractType<?> type = cellNameType.subtype(i); builder.add(Fields.defaultValue(type)); } Composite prefix = builder.build(); Iterable<ColumnDefinition> cols = table.metadata.regularAndStaticColumns(); for (ColumnDefinition columnDef : cols) { if (columnDef.equals(primaryColumnDefinition)) { addColumn(table, cleanColumnFamily, primaryColumnDefinition, prefix, metaColumnValue); } else { addColumn(table, cleanColumnFamily, columnDef, prefix, Fields.defaultValue(columnDef.type)); } } DecoratedKey dk = table.partitioner.decorateKey(defaultPartitionKey); return new Row(dk, cleanColumnFamily); } else { return null; } }