String columnString; try { columnString = serializers.columnAsString(column.getRawName()); valueString = serializers.valueAsString(column.getRawName(), column.getByteBufferValue());
@Override public synchronized Boolean apply(Row<K, C> row) { long size = 0; for (Column<C> column : row.getColumns()) { size += column.getRawName().limit() + column.getByteBufferValue().limit(); } StringBuilder sb = new StringBuilder(); sb.append(String.format("- row: '%s' size: '%dl' count: '%dl' \n", row.getKey(), size, row.getColumns().size())); if (showColumns) { for (Column<C> column : row.getColumns()) { sb.append(String.format(" '%s' (ts='%dl', ttl='%d')\n", column.getName(), column.getTimestamp(), column.getTtl())); } } try { out.write(sb.toString().getBytes()); } catch (IOException e) { } return true; }
@Override public synchronized Boolean apply(Row<K, C> row) { long size = 0; for (Column<C> column : row.getColumns()) { size += column.getRawName().limit() + column.getByteBufferValue().limit(); } StringBuilder sb = new StringBuilder(); sb.append(String.format("- row: '%s' size: '%dl' count: '%dl' \n", row.getKey(), size, row.getColumns().size())); if (showColumns) { for (Column<C> column : row.getColumns()) { sb.append(String.format(" '%s' (ts='%dl', ttl='%d')\n", column.getName(), column.getTimestamp(), column.getTtl())); } } try { out.write(sb.toString().getBytes()); } catch (IOException e) { } return true; }
for (int i = 1; i < columns.size(); i++) { Column<C> nextColumn = columns.get(i); if (!nextColumn.getRawName().equals(foundColumn.getRawName())) { throw new NotUniqueException("The provided rows are not part of the same uniquness constraint");
for (int i = 1; i < columns.size(); i++) { Column<C> nextColumn = columns.get(i); if (!nextColumn.getRawName().equals(foundColumn.getRawName())) { throw new NotUniqueException("The provided rows are not part of the same uniquness constraint");
String columnString; try { columnString = serializers.columnAsString(column.getRawName()); valueString = serializers.valueAsString(column.getRawName(), column.getByteBufferValue());
String key = SystemUtils.convertToString(columnSerializer, col.getRawName()); bytes += col.getRawName().capacity(); String value = SystemUtils.convertToString(valueSerializer, col.getByteBufferValue()); bytes += col.getByteBufferValue().capacity();
@Override public ResponseData get(Object rkey, Object colName) throws OperationException { StringBuffer response = new StringBuffer(); int bytes = 0; OperationResult<Column<Object>> opResult = null; try { opResult = AstyanaxConnection.instance.keyspace().prepareQuery(cfs).getKey(rkey).getColumn(colName).execute(); bytes = opResult.getResult().getRawName().capacity(); bytes += opResult.getResult().getByteBufferValue().capacity(); String value = SystemUtils.convertToString(valueSerializer, opResult.getResult().getByteBufferValue()); response.append(value); } catch (NotFoundException ex) { // ignore this because nothing is available to show response.append("...Not found..."); } catch (ConnectionException e) { throw new OperationException(e); } return new AstyanaxResponseData(response.toString(), bytes, opResult, rkey, colName, null); }
@Override public ResponseData getComposite(String key, String colName) throws OperationException { StringBuffer response = new StringBuffer(); int bytes = 0; OperationResult<Column<ByteBuffer>> opResult = null; try { SerializerPackage sp = AstyanaxConnection.instance.keyspace().getSerializerPackage(cfName, false); ByteBuffer bbName = sp.columnAsByteBuffer(colName); ByteBuffer bbKey = sp.keyAsByteBuffer(key); ColumnFamily<ByteBuffer, ByteBuffer> columnFamily = new ColumnFamily(cfName, ByteBufferSerializer.get(), ByteBufferSerializer.get()); opResult = AstyanaxConnection.instance.keyspace().prepareQuery(columnFamily).getKey(bbKey).getColumn(bbName).execute(); bytes = opResult.getResult().getByteBufferValue().capacity(); bytes += opResult.getResult().getRawName().capacity(); String value = SystemUtils.convertToString(valueSerializer, opResult.getResult().getByteBufferValue()); response.append(value); } catch (NotFoundException ex) { // ignore this because nothing is available to show response.append("...Not found..."); } catch (Exception e) { throw new OperationException(e); } return new AstyanaxResponseData(response.toString(), bytes, opResult, key, colName, null); }