MapSerializer mapSerializer = mapType.getSerializer(); Map outputCollection = new HashMap(); if (useNativeProtocol2)
public static Value fromSerialized(ByteBuffer value, MapType type, ProtocolVersion version) throws InvalidRequestException { try { // Collections have this small hack that validate cannot be called on a serialized object, // but compose does the validation (so we're fine). Map<?, ?> m = type.getSerializer().deserializeForNativeProtocol(value, version); Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<>(m.size()); for (Map.Entry<?, ?> entry : m.entrySet()) map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue())); return new Value(map); } catch (MarshalException e) { throw new InvalidRequestException(e.getMessage()); } }
public static Value fromSerialized(ByteBuffer value, MapType type, ProtocolVersion version) throws InvalidRequestException { try { // Collections have this small hack that validate cannot be called on a serialized object, // but compose does the validation (so we're fine). Map<?, ?> m = type.getSerializer().deserializeForNativeProtocol(value, version); Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<>(m.size()); for (Map.Entry<?, ?> entry : m.entrySet()) map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue())); return new Value(map); } catch (MarshalException e) { throw new InvalidRequestException(e.getMessage()); } }
public static Value fromSerialized(ByteBuffer value, MapType type, ProtocolVersion version) throws InvalidRequestException { try { // Collections have this small hack that validate cannot be called on a serialized object, // but compose does the validation (so we're fine). Map<?, ?> m = type.getSerializer().deserializeForNativeProtocol(value, version); Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<>(m.size()); for (Map.Entry<?, ?> entry : m.entrySet()) map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue())); return new Value(map); } catch (MarshalException e) { throw new InvalidRequestException(e.getMessage()); } }
public static Value fromSerialized(ByteBuffer value, MapType type, ProtocolVersion version) throws InvalidRequestException { try { // Collections have this small hack that validate cannot be called on a serialized object, // but compose does the validation (so we're fine). Map<?, ?> m = type.getSerializer().deserializeForNativeProtocol(value, version); Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<>(m.size()); for (Map.Entry<?, ?> entry : m.entrySet()) map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue())); return new Value(map); } catch (MarshalException e) { throw new InvalidRequestException(e.getMessage()); } }
public static Value fromSerialized(ByteBuffer value, MapType type, int version) throws InvalidRequestException { try { // Collections have this small hack that validate cannot be called on a serialized object, // but compose does the validation (so we're fine). Map<?, ?> m = (Map<?, ?>)type.getSerializer().deserializeForNativeProtocol(value, version); Map<ByteBuffer, ByteBuffer> map = new LinkedHashMap<ByteBuffer, ByteBuffer>(m.size()); for (Map.Entry<?, ?> entry : m.entrySet()) map.put(type.getKeysType().decompose(entry.getKey()), type.getValuesType().decompose(entry.getValue())); return new Value(map); } catch (MarshalException e) { throw new InvalidRequestException(e.getMessage()); } }
} else if (type instanceof MapType) { MapType mapType = ClusterService.getMapType(ksName, cfName, name); MapSerializer serializer = mapType.getSerializer(); Map map = (Map)value; List<ByteBuffer> buffers = serializer.serializeValues((Map)value);
public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row) { assert key != null; // We support null conditions for LWT (in ColumnCondition) but not for RowFilter. // TODO: we should try to merge both code someday. assert value != null; if (row.isStatic() != column.isStatic()) return true; MapType<?, ?> mt = (MapType<?, ?>)column.type; if (column.isComplex()) { Cell cell = row.getCell(column, CellPath.create(key)); return cell != null && mt.valueComparator().compare(cell.value(), value) == 0; } else { ByteBuffer serializedMap = getValue(metadata, partitionKey, row); if (serializedMap == null) return false; ByteBuffer foundValue = mt.getSerializer().getSerializedValue(serializedMap, key, mt.getKeysType()); return foundValue != null && mt.valueComparator().compare(foundValue, value) == 0; } }
public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row) { assert key != null; // We support null conditions for LWT (in ColumnCondition) but not for RowFilter. // TODO: we should try to merge both code someday. assert value != null; if (row.isStatic() != column.isStatic()) return true; MapType<?, ?> mt = (MapType<?, ?>)column.type; if (column.isComplex()) { Cell cell = row.getCell(column, CellPath.create(key)); return cell != null && mt.valueComparator().compare(cell.value(), value) == 0; } else { ByteBuffer serializedMap = getValue(metadata, partitionKey, row); if (serializedMap == null) return false; ByteBuffer foundValue = mt.getSerializer().getSerializedValue(serializedMap, key, mt.getKeysType()); return foundValue != null && mt.valueComparator().compare(foundValue, value) == 0; } }
public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row) { assert key != null; // We support null conditions for LWT (in ColumnCondition) but not for RowFilter. // TODO: we should try to merge both code someday. assert value != null; if (row.isStatic() != column.isStatic()) return true; MapType<?, ?> mt = (MapType<?, ?>)column.type; if (column.isComplex()) { Cell cell = row.getCell(column, CellPath.create(key)); return cell != null && mt.valueComparator().compare(cell.value(), value) == 0; } else { ByteBuffer serializedMap = getValue(metadata, partitionKey, row); if (serializedMap == null) return false; ByteBuffer foundValue = mt.getSerializer().getSerializedValue(serializedMap, key, mt.getKeysType()); return foundValue != null && mt.valueComparator().compare(foundValue, value) == 0; } }
case MAP: MapType<?,?> mapType = (MapType)def.type; if (!mapType.getSerializer().deserialize(dataValue).containsValue(mapType.getValuesType().getSerializer().deserialize(expression.value))) return false; break; if (mapType.getSerializer().getSerializedValue(dataValue, expression.value, mapType.getKeysType()) == null) return false;
return foundValue != null && mapType.getSerializer().getSerializedValue(foundValue, value, mapType.getKeysType()) != null;
cellValue = cell == null ? null : mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType());
cellValue = cell == null ? null : mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType());
cellValue = cell == null ? null : mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType());
ByteBuffer mapElementValue = mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType()); return compareWithOperator(operator, mapType.getValuesType(), value, mapElementValue);
ByteBuffer mapElementValue = mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType()); return compareWithOperator(operator, mapType.getValuesType(), value, mapElementValue);
ByteBuffer mapElementValue = mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType()); return compareWithOperator(operator, mapType.getValuesType(), value, mapElementValue);
ByteBuffer mapElementValue = cell.isLive(now) ? mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType()) : null; return compareWithOperator(operator, mapType.getValuesType(), value, mapElementValue);
ByteBuffer mapElementValue = null; if (cell != null && cell.isLive(now)) mapElementValue = mapType.getSerializer().getSerializedValue(cell.value(), collectionElement, mapType.getKeysType()); for (ByteBuffer value : inValues)