use of org.apache.cassandra.thrift.ColumnOrSuperColumn in project eiger by wlloyd.
the class ColumnOrSuperColumnHelper method extractEvtAndLvt.
public static EvtAndLvt extractEvtAndLvt(Collection<ColumnOrSuperColumn> coscCollection) {
long maxEarliestValidTime = Long.MIN_VALUE;
long minLatestValidTime = Long.MAX_VALUE;
for (ColumnOrSuperColumn cosc : coscCollection) {
EvtAndLvt evtAndLvt = ColumnOrSuperColumnHelper.extractEvtAndLvt(cosc);
maxEarliestValidTime = Math.max(maxEarliestValidTime, evtAndLvt.getEarliestValidTime());
minLatestValidTime = Math.min(minLatestValidTime, evtAndLvt.getLatestValidTime());
}
return new EvtAndLvt(maxEarliestValidTime, minLatestValidTime);
}
use of org.apache.cassandra.thrift.ColumnOrSuperColumn in project eiger by wlloyd.
the class ColumnOrSuperColumnHelper method toString.
public static String toString(ColumnOrSuperColumn cosc) {
if (cosc.isSetColumn()) {
StringBuilder sb = new StringBuilder(ByteBufferUtil.bytesToHex(cosc.column.name));
sb.append(":");
sb.append(cosc.column.isSetValue() ? ByteBufferUtil.bytesToHex(cosc.column.value) : "-");
sb.append("@");
sb.append(cosc.column.isSetTimestamp() ? cosc.column.timestamp : "-");
return sb.toString();
} else if (cosc.isSetCounter_column()) {
return ByteBufferUtil.bytesToHex(cosc.counter_column.name) + ":" + cosc.counter_column.value;
} else if (cosc.isSetSuper_column()) {
String superColumnString = new String(ByteBufferUtil.bytesToHex(cosc.super_column.name) + "={");
for (Column column : cosc.super_column.columns) {
superColumnString += ByteBufferUtil.bytesToHex(column.name) + ":" + ByteBufferUtil.bytesToHex(column.value) + "@" + column.timestamp + ", ";
}
return superColumnString.substring(0, superColumnString.length() - 2) + "}";
} else {
String superColumnString = new String(ByteBufferUtil.bytesToHex(cosc.super_column.name) + "={");
for (CounterColumn column : cosc.counter_super_column.columns) {
superColumnString += ByteBufferUtil.bytesToHex(column.name) + ":" + column.value + ", ";
}
return superColumnString.substring(0, superColumnString.length() - 2) + "}";
}
}
use of org.apache.cassandra.thrift.ColumnOrSuperColumn in project brisk by riptano.
the class HistoricalPriceInserter method genDaysPrices.
private Map<String, List<Mutation>> genDaysPrices(ByteBuffer date) {
Map<String, List<Mutation>> prices = new HashMap<String, List<Mutation>>();
Mutation m = new Mutation();
m.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(new Column().setName(date).setValue(ByteBufferUtil.bytes(String.valueOf((double) (Pricer.randomizer.nextDouble() * 1000)))).setTimestamp(System.currentTimeMillis())));
prices.put("StockHist", Arrays.asList(m));
return prices;
}
Aggregations