BATCH
128129130131132133134135136137
private void doAdd(ColumnFamily cf, ColumnNameBuilder builder, CollectionType validator, UpdateParameters params) throws InvalidRequestException { for (int i = 0; i < values.size(); ++i) { ColumnNameBuilder b = i == values.size() - 1 ? builder : builder.copy(); ByteBuffer name = b.add(values.get(i).getByteBuffer(validator.nameComparator(), params.variables)).build(); cf.addColumn(params.makeColumn(name, ByteBufferUtil.EMPTY_BYTE_BUFFER)); } }
138139140141142143144145146147
private void doDiscard(ColumnFamily cf, ColumnNameBuilder builder, CollectionType validator, UpdateParameters params) throws InvalidRequestException { for (int i = 0; i < values.size(); ++i) { ColumnNameBuilder b = i == values.size() - 1 ? builder : builder.copy(); ByteBuffer name = b.add(values.get(i).getByteBuffer(validator.nameComparator(), params.variables)).build(); cf.addColumn(params.makeTombstone(name)); } }
158159160161162163164165166167168169170
{ List<?> l = validator.compose(params.variables.get(values.bindIndex)); for (int i = 0; i < l.size(); i++) { ColumnNameBuilder b = i == l.size() - 1 ? builder : builder.copy(); ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes()); ByteBuffer name = b.add(uuid).build(); cf.addColumn(params.makeColumn(name, validator.valueComparator().decompose(l.get(i)))); } } catch (MarshalException e) {
183184185186187188189190191192193194195196
{ List<?> l = validator.compose(params.variables.get(values.bindIndex)); for (int i = 0; i < l.size(); i++) { ColumnNameBuilder b = i == l.size() - 1 ? builder : builder.copy(); PrecisionTime pt = getNextTime(time); ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(pt.millis, pt.nanos)); ByteBuffer name = b.add(uuid).build(); cf.addColumn(params.makeColumn(name, validator.valueComparator().decompose(l.get(i)))); } } catch (MarshalException e) {
238239240241242243244245246247248
private void doAppend(ColumnFamily cf, ColumnNameBuilder builder, CollectionType validator, UpdateParameters params) throws InvalidRequestException { for (int i = 0; i < values.size(); i++) { ColumnNameBuilder b = i == values.size() - 1 ? builder : builder.copy(); ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes()); ByteBuffer name = b.add(uuid).build(); cf.addColumn(params.makeColumn(name, values.get(i).getByteBuffer(validator.valueComparator(), params.variables))); } }
251252253254255256257258259260261262
{ long time = REFERENCE_TIME - (System.currentTimeMillis() - REFERENCE_TIME); for (int i = 0; i < values.size(); i++) { ColumnNameBuilder b = i == values.size() - 1 ? builder : builder.copy(); PrecisionTime pt = getNextTime(time); ByteBuffer uuid = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(pt.millis, pt.nanos)); ByteBuffer name = b.add(uuid).build(); cf.addColumn(params.makeColumn(name, values.get(i).getByteBuffer(validator.valueComparator(), params.variables))); } }
59606162636465666768
return types; } public ByteBuffer execute(List<ByteBuffer> parameters) throws InvalidRequestException { ColumnNameBuilder builder = cfDef.getKeyNameBuilder(); for (ByteBuffer bb : parameters) builder.add(bb); return partitioner.getTokenFactory().toByteArray(partitioner.getToken(builder.build())); }
146147148149150151152
} } public static ColumnSpecification keySpecOf(ColumnSpecification column, MapType type) { return new ColumnSpecification(column.ksName, column.cfName, new ColumnIdentifier("key(" + column.name + ")", true), type.keys); }
151152153154155156157
return new ColumnSpecification(column.ksName, column.cfName, new ColumnIdentifier("key(" + column.name + ")", true), type.keys); } public static ColumnSpecification valueSpecOf(ColumnSpecification column, MapType type) { return new ColumnSpecification(column.ksName, column.cfName, new ColumnIdentifier("value(" + column.name + ")", true), type.values); }
318319320321322323324
} } public static ColumnSpecification indexSpecOf(ColumnSpecification column) { return new ColumnSpecification(column.ksName, column.cfName, new ColumnIdentifier("idx(" + column.name + ")", true), Int32Type.instance); }