@Override public List<CounterSuperColumn> execute(Cassandra.Client cassandra) throws HectorException { try { List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(key, columnParent, predicate, getThriftCl(OperationType.READ)); if (cosclist == null) { return null; } ArrayList<CounterSuperColumn> result = new ArrayList<CounterSuperColumn>(cosclist.size()); for (ColumnOrSuperColumn cosc : cosclist) { result.add(cosc.getCounter_super_column()); } return result; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public List<SuperColumn> execute(Cassandra.Client cassandra) throws HectorException { try { List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(key, columnParent, predicate, getThriftCl(OperationType.READ)); if (cosclist == null) { return null; } ArrayList<SuperColumn> result = new ArrayList<SuperColumn>(cosclist.size()); for (ColumnOrSuperColumn cosc : cosclist) { result.add(cosc.getSuper_column()); } return result; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public List<Column> execute(Cassandra.Client cassandra) throws HectorException { try { List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(key, columnParent, predicate, getThriftCl(OperationType.READ)); if (cosclist == null) { return null; } ArrayList<Column> result = new ArrayList<Column>(cosclist.size()); for (ColumnOrSuperColumn cosc : cosclist) { result.add(cosc.getColumn()); } return result; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); try { ByteBuffer sKey = keySerializer.toByteBuffer(key); cosc.put(sKey, cassandra.get_slice(sKey, columnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType)))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); try { ByteBuffer sKey = keySerializer.toByteBuffer(key); cosc.put(sKey, cassandra.get_slice(sKey, columnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily)))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public List<ColumnOrSuperColumn> get_slice(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { return client.get_slice(key, column_parent, predicate, consistency_level); }
public List<ColumnOrSuperColumn> get(ByteBuffer keyBuffer, ByteBuffer start, ByteBuffer finish, int order) throws Exception { SliceRange sliceRange = new SliceRange(); // start/finish sliceRange.setStart(start).setFinish(finish); // reversed/count sliceRange.setReversed(false).setCount(order); // initialize SlicePredicate with existing SliceRange SlicePredicate predicate = new SlicePredicate().setSlice_range(sliceRange); ColumnParent parent = new ColumnParent(cfName); return client.get_slice(keyBuffer, parent, predicate, cl); }
@Override public List<ColumnOrSuperColumn> get_slice(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { return client.get_slice(key, column_parent, predicate, consistency_level); }
List<ColumnOrSuperColumn> columnOrSuperColumns = CassandraCli.client.get_slice(key, new ColumnParent( "PERSONCASSANDRA"), predicate, ConsistencyLevel.ONE); Thread.sleep(5000); columnOrSuperColumns = CassandraCli.client.get_slice(key, new ColumnParent("PERSONCASSANDRA"), predicate, ConsistencyLevel.ONE); for (ColumnOrSuperColumn cosc : columnOrSuperColumns)
results = conn.getClient().get_slice(ByteBuffer.wrap(rowKey), parent, predicate, getConsistencyLevel());
List<ColumnOrSuperColumn> columnOrSuperColumns = CassandraCli.client.get_slice(key, new ColumnParent( "PERSONCASSANDRA"), predicate, ConsistencyLevel.ONE); Thread.sleep(5000); columnOrSuperColumns = CassandraCli.client.get_slice(key, new ColumnParent("PERSONCASSANDRA"), predicate, ConsistencyLevel.ONE); for (ColumnOrSuperColumn cosc : columnOrSuperColumns)
coscList = conn.getClient().get_slice(ByteBuffer.wrap(rowKey), parent, predicate, getConsistencyLevel());
try coscList = conn.getClient().get_slice(ByteBuffer.wrap(rowKey.getBytes()), new ColumnParent(columnFamilyName), colPredicate, consistencyLevel);
List<ColumnOrSuperColumn> columnOrSuperColumns = conn.getClient().get_slice(key, new ColumnParent(tableName), predicate, consistencyLevel);
@Override public List<CounterColumn> execute(Cassandra.Client cassandra) throws HectorException { try { List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(key, columnParent, predicate, getThriftCl(OperationType.READ)); if (cosclist == null) { return null; } ArrayList<CounterColumn> result = new ArrayList<CounterColumn>(cosclist.size()); for (ColumnOrSuperColumn cosc : cosclist) { if (cosc.isSetCounter_column()) { result.add(cosc.getCounter_column()); } else { // Inconsistency throw new HectorException("Regular Column is part of the set of Counter Column"); } } return result; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Column execute(Cassandra.Client cassandra) throws HectorException { try { if ( queryLogger.isDebugEnabled() ) { queryLogger.debug("---------\nColumnFamily: {} slicePredicate: {}", columnFamilyName, activeSlicePredicate.toString()); } K key = _keys.get(0); List<ColumnOrSuperColumn> cosclist = cassandra.get_slice(keySerializer.toByteBuffer(key), columnParent, activeSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); applyResultStatus(execTime, getCassandraHost()); applyToRow(key, cosclist); if ( queryLogger.isDebugEnabled() ) { queryLogger.debug("Execution took {} microseconds on host {}\n----------", lastExecutionTime, lastHostUsed); } } catch (Exception e) { throw exceptionsTranslator.translate(e); } hasValues = true; return null; } });
@Override public SuperColumn execute(Cassandra.Client cassandra) throws HectorException { ColumnParent clp = new ColumnParent(columnPath.getColumn_family()); clp.setSuper_column(columnPath.getSuper_column()); SlicePredicate sp = new SlicePredicate(); sp.setSlice_range(sliceRange); try { List<ColumnOrSuperColumn> cosc = cassandra.get_slice(key, clp, sp, getThriftCl(OperationType.READ)); if (cosc == null || cosc.isEmpty()) { return null; } return new SuperColumn(ByteBuffer.wrap(columnPath.getSuper_column()), getColumnList(cosc)); } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); try { ByteBuffer sKey = keySerializer.toByteBuffer(key); cosc.put(sKey, cassandra.get_slice(sKey, columnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType)))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public Map<ByteBuffer,List<ColumnOrSuperColumn>> execute(Cassandra.Client cassandra) throws HectorException { Map<ByteBuffer,List<ColumnOrSuperColumn>> cosc = new LinkedHashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); try { ByteBuffer sKey = keySerializer.toByteBuffer(key); cosc.put(sKey, cassandra.get_slice(sKey, columnParent, workingSlicePredicate.toThrift(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType, columnFamily)))); } catch (Exception e) { throw exceptionsTranslator.translate(e); } return cosc; } });
@Override public List<ColumnOrSuperColumn> get_slice(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { return client.get_slice(key, column_parent, predicate, consistency_level); }