public List<ByteBuffer> serializedValues(List<Cell> cells) { List<ByteBuffer> bbs = new ArrayList<ByteBuffer>(cells.size()); for (Cell c : cells) bbs.add(c.name().collectionElement()); return bbs; } }
public List<ByteBuffer> serializedValues(List<Cell> cells) { assert isMultiCell; List<ByteBuffer> bbs = new ArrayList<ByteBuffer>(cells.size() * 2); for (Cell c : cells) { bbs.add(c.name().collectionElement()); bbs.add(c.value()); } return bbs; } }
private static boolean setOrListAppliesTo(AbstractType<?> type, Iterator<Cell> iter, Iterator<ByteBuffer> conditionIter, Operator operator, boolean isSet) { while(iter.hasNext()) { if (!conditionIter.hasNext()) return operator.equals(Operator.GT) || operator.equals(Operator.GTE) || operator.equals(Operator.NEQ); // for lists we use the cell value; for sets we use the cell name ByteBuffer cellValue = isSet? iter.next().name().collectionElement() : iter.next().value(); int comparison = type.compare(cellValue, conditionIter.next()); if (comparison != 0) return evaluateComparisonWithOperator(comparison, operator); } if (conditionIter.hasNext()) return operator.equals(Operator.LT) || operator.equals(Operator.LTE) || operator.equals(Operator.NEQ); // they're equal return operator == Operator.EQ || operator == Operator.LTE || operator == Operator.GTE; }
static boolean mapAppliesTo(MapType type, Iterator<Cell> iter, Map<ByteBuffer, ByteBuffer> elements, Operator operator) { Iterator<Map.Entry<ByteBuffer, ByteBuffer>> conditionIter = elements.entrySet().iterator(); while(iter.hasNext()) { if (!conditionIter.hasNext()) return operator.equals(Operator.GT) || operator.equals(Operator.GTE) || operator.equals(Operator.NEQ); Map.Entry<ByteBuffer, ByteBuffer> conditionEntry = conditionIter.next(); Cell c = iter.next(); // compare the keys int comparison = type.getKeysType().compare(c.name().collectionElement(), conditionEntry.getKey()); if (comparison != 0) return evaluateComparisonWithOperator(comparison, operator); // compare the values comparison = type.getValuesType().compare(c.value(), conditionEntry.getValue()); if (comparison != 0) return evaluateComparisonWithOperator(comparison, operator); } if (conditionIter.hasNext()) return operator.equals(Operator.LT) || operator.equals(Operator.LTE) || operator.equals(Operator.NEQ); // they're equal return operator == Operator.EQ || operator == Operator.LTE || operator == Operator.GTE; } }
AbstractType valueType = validator.valueComparator(); FieldCreator valueFieldCreator = CassandraUtils.fromAbstractType(valueType.asCQL3Type()).fieldCreator; ByteBuffer collectionElement = cellName.collectionElement(); if (validator instanceof MapType) { if (fieldTypesArr != null) {
AbstractType keyType = validator.nameComparator(); AbstractType valueType = validator.valueComparator(); ByteBuffer keyBuf = column.name().collectionElement(); if (valueValidator instanceof MapType) { actualColumnName = actualColumnName + "." + keyType.compose(keyBuf);
if (type.kind == CollectionType.Kind.SET) if (type.nameComparator().compare(cell.name().collectionElement(), expr.value) == 0) return true;