public List<Cell> enforceLimit(ColumnDefinition def, List<Cell> cells, int version) { assert isMultiCell(); if (version >= Server.VERSION_3 || cells.size() <= MAX_ELEMENTS) return cells; logger.error("Detected collection for table {}.{} with {} elements, more than the {} limit. Only the first {}" + " elements will be returned to the client. Please see " + "http://cassandra.apache.org/doc/cql3/CQL.html#collections for more details.", def.ksName, def.cfName, cells.size(), MAX_ELEMENTS, MAX_ELEMENTS); return cells.subList(0, MAX_ELEMENTS); }
@Override public boolean isValueCompatibleWithInternal(AbstractType<?> previous) { // for multi-cell collections, compatibility and value-compatibility are the same if (this.isMultiCell()) return isCompatibleWith(previous); if (this == previous) return true; if (!getClass().equals(previous.getClass())) return false; CollectionType tprev = (CollectionType) previous; if (this.isMultiCell() != tprev.isMultiCell()) return false; // subclasses should handle compatibility checks for frozen collections return isValueCompatibleWithFrozen(tprev); }
@Override public boolean isValueCompatibleWithInternal(AbstractType<?> previous) { // for multi-cell collections, compatibility and value-compatibility are the same if (this.isMultiCell()) return isCompatibleWith(previous); if (this == previous) return true; if (!getClass().equals(previous.getClass())) return false; CollectionType tprev = (CollectionType) previous; if (this.isMultiCell() != tprev.isMultiCell()) return false; // subclasses should handle compatibility checks for frozen collections return isValueCompatibleWithFrozen(tprev); }
@Override public boolean isValueCompatibleWithInternal(AbstractType<?> previous) { // for multi-cell collections, compatibility and value-compatibility are the same if (this.isMultiCell()) return isCompatibleWith(previous); if (this == previous) return true; if (!getClass().equals(previous.getClass())) return false; CollectionType tprev = (CollectionType) previous; if (this.isMultiCell() != tprev.isMultiCell()) return false; // subclasses should handle compatibility checks for frozen collections return isValueCompatibleWithFrozen(tprev); }
@Override public boolean isValueCompatibleWithInternal(AbstractType<?> previous) { // for multi-cell collections, compatibility and value-compatibility are the same if (this.isMultiCell()) return isCompatibleWith(previous); if (this == previous) return true; if (!getClass().equals(previous.getClass())) return false; CollectionType tprev = (CollectionType) previous; if (this.isMultiCell() != tprev.isMultiCell()) return false; // subclasses should handle compatibility checks for frozen collections return isValueCompatibleWithFrozen(tprev); }
public ByteBuffer serializeForNativeProtocol(ColumnDefinition def, List<Cell> cells, int version) { assert isMultiCell(); cells = enforceLimit(def, cells, version); List<ByteBuffer> values = serializedValues(cells); return CollectionSerializer.pack(values, cells.size(), version); }
@Override public boolean isCompatibleWith(AbstractType<?> previous) { if (this == previous) return true; if (!getClass().equals(previous.getClass())) return false; CollectionType tprev = (CollectionType) previous; if (this.isMultiCell() != tprev.isMultiCell()) return false; // subclasses should handle compatibility checks for frozen collections if (!this.isMultiCell()) return isCompatibleWithFrozen(tprev); if (!this.nameComparator().isCompatibleWith(tprev.nameComparator())) return false; // the value comparator is only used for Cell values, so sorting doesn't matter return this.valueComparator().isValueCompatibleWith(tprev.valueComparator()); }
public ByteBuffer serializeForNativeProtocol(Iterator<Cell> cells, ProtocolVersion version) { assert isMultiCell(); List<ByteBuffer> values = serializedValues(cells); int size = collectionSize(values); return CollectionSerializer.pack(values, size, version); }
public ByteBuffer serializeForNativeProtocol(Iterator<Cell> cells, ProtocolVersion version) { assert isMultiCell(); List<ByteBuffer> values = serializedValues(cells); int size = collectionSize(values); return CollectionSerializer.pack(values, size, version); }
@Override public void validateCellValue(ByteBuffer cellValue) throws MarshalException { if (isMultiCell()) valueComparator().validateCellValue(cellValue); else super.validateCellValue(cellValue); }
@Override public void validateCellValue(ByteBuffer cellValue) throws MarshalException { if (isMultiCell()) valueComparator().validateCellValue(cellValue); else super.validateCellValue(cellValue); }
@Override public void validateCellValue(ByteBuffer cellValue) throws MarshalException { if (isMultiCell()) valueComparator().validateCellValue(cellValue); else super.validateCellValue(cellValue); }
public ByteBuffer serializeForNativeProtocol(Iterator<Cell> cells, ProtocolVersion version) { assert isMultiCell(); List<ByteBuffer> values = serializedValues(cells); int size = collectionSize(values); return CollectionSerializer.pack(values, size, version); }
@Override public void validateCellValue(ByteBuffer cellValue) throws MarshalException { if (isMultiCell()) valueComparator().validate(cellValue); else super.validateCellValue(cellValue); }
@Override public void validateCellValue(ByteBuffer cellValue) throws MarshalException { if (isMultiCell()) valueComparator().validateCellValue(cellValue); else super.validateCellValue(cellValue); }
public ByteBuffer serializeForNativeProtocol(Iterator<Cell> cells, ProtocolVersion version) { assert isMultiCell(); List<ByteBuffer> values = serializedValues(cells); int size = collectionSize(values); return CollectionSerializer.pack(values, size, version); }
@Override public boolean equals(Object o, boolean ignoreFreezing) { if (this == o) return true; if (!(o instanceof CollectionType)) return false; CollectionType other = (CollectionType)o; if (kind != other.kind) return false; if (!ignoreFreezing && isMultiCell() != other.isMultiCell()) return false; return nameComparator().equals(other.nameComparator(), ignoreFreezing) && valueComparator().equals(other.valueComparator(), ignoreFreezing); }
@Override public boolean equals(Object o, boolean ignoreFreezing) { if (this == o) return true; if (!(o instanceof CollectionType)) return false; CollectionType other = (CollectionType)o; if (kind != other.kind) return false; if (!ignoreFreezing && isMultiCell() != other.isMultiCell()) return false; return nameComparator().equals(other.nameComparator(), ignoreFreezing) && valueComparator().equals(other.valueComparator(), ignoreFreezing); }
@Override public boolean equals(Object o, boolean ignoreFreezing) { if (this == o) return true; if (!(o instanceof CollectionType)) return false; CollectionType other = (CollectionType)o; if (kind != other.kind) return false; if (!ignoreFreezing && isMultiCell() != other.isMultiCell()) return false; return nameComparator().equals(other.nameComparator(), ignoreFreezing) && valueComparator().equals(other.valueComparator(), ignoreFreezing); }
@Override public boolean equals(Object o, boolean ignoreFreezing) { if (this == o) return true; if (!(o instanceof CollectionType)) return false; CollectionType other = (CollectionType)o; if (kind != other.kind) return false; if (!ignoreFreezing && isMultiCell() != other.isMultiCell()) return false; return nameComparator().equals(other.nameComparator(), ignoreFreezing) && valueComparator().equals(other.valueComparator(), ignoreFreezing); }