@Override public int compare(ByteArray o1, ByteArray o2) { if (o1.getKey() == null && o2.getKey() != null) return -1; else if (o2.getKey() == null && o1.getKey() != null) return 1; else if (o2.getKey() == null && o1.getKey() == null) return 0; String left = StandardConverters.convertFromBytes(String.class, o1.getKey()); String right = StandardConverters.convertFromBytes(String.class, o2.getKey()); return left.compareTo(right); }
private void loadPartitions(DboTableMeta meta2) { DboTableMeta tableMeta = mgr.find(DboTableMeta.class, "partitions"); NoSqlSession session = mgr.getSession(); byte[] rowKey = StandardConverters.convertToBytes(meta2.getColumnFamily()); Cursor<Column> results = session.columnSlice(tableMeta, rowKey, null, null, 1000, BigInteger.class); while (results.next()) { Column col = results.getCurrent(); BigInteger time = StandardConverters.convertFromBytes(BigInteger.class, col.getName()); existingPartitions.add(time.longValue()); } Collections.sort(existingPartitions); }