private static List<CellWithTimestamp> getCells(Function<CqlRow, CellWithTimestamp> cellTsExtractor, CqlResult cqlResult) { return cqlResult.getRows() .stream() .map(cellTsExtractor) .collect(Collectors.toList()); }
if (cqlResult != null && (cqlResult.getRows() != null || cqlResult.getRowsSize() > 0)) { results = new ArrayList<Object>(cqlResult.getRowsSize()); Iterator<CqlRow> iter = cqlResult.getRowsIterator();
private static boolean isSuccessfullyApplied(CqlResult casResult) { byte[] appliedValue = getNamedColumnValue(casResult.getRows().get(0).getColumns(), APPLIED_COLUMN); return Arrays.equals(appliedValue, CQL_SUCCESS.toByteArray()); }
if (result != null && (result.getRows() != null || result.getRowsSize() > 0)) { returnedEntities = new ArrayList<Object>(result.getRowsSize()); Iterator<CqlRow> iter = result.getRowsIterator();
private static Map<String, byte[]> getRelevantCassandraState( CqlResult casResult, Map<String, Pair<byte[], byte[]>> casMap) { return casResult.getRows().stream() .filter(row -> { String columnName = getColumnNameFromRow(row); return casMap.containsKey(columnName); }) .collect(Collectors.toMap( CassandraTimestampUtils::getColumnNameFromRow, row -> getNamedColumnValue(row.getColumns(), VALUE_COLUMN))); }
if (result != null && (result.getRows() != null || result.getRowsSize() > 0)) { Iterator<CqlRow> iterator = result.getRowsIterator(); while (iterator.hasNext()) {
public static Map<String, byte[]> getValuesFromSelectionResult(CqlResult result) { return result.getRows().stream() .map(CqlRow::getColumns) .collect(Collectors.toMap( cols -> PtBytes.toString(getNamedColumnValue(cols, COLUMN_NAME_COLUMN)), cols -> getNamedColumnValue(cols, VALUE_COLUMN))); }
private static CqlResult createMockCqlResult(List<CqlRow> rows) { CqlResult result = mock(CqlResult.class); when(result.getRows()).thenReturn(rows); return result; }
static CheckAndSetResult<ByteString> decodeCqlResult(CqlResult cqlResult) { CqlRow resultRow = Iterables.getOnlyElement(cqlResult.getRows()); return ImmutableCheckAndSetResult.of(isResultSuccessful(resultRow), existingValues(resultRow)); }
Iterator<CqlRow> rowIter = cqlResult.getRows().iterator(); while (rowIter.hasNext()) { CqlRow row = rowIter.next();
@Override public CqlResult execute_cql3_query(CqlQuery cqlQuery, Compression compression, ConsistencyLevel consistency) throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<CqlResult, TException>) () -> client.execute_cql3_query(cqlQuery, compression, consistency), (logger, timer) -> cqlQuery.logSlowResult(logger, timer), (logger, cqlResult) -> { if (cqlResult.getRows() == null) { // different from an empty list logger.log("and returned null rows. The query was started at time {}", LoggingArgs.startTimeMillis(startTime)); } else { logger.log("and returned {} rows. The query was started at time {}", SafeArg.of("numRows", cqlResult.getRows().size()), LoggingArgs.startTimeMillis(startTime)); } }); } }
public static long getCqlResultSize(CqlResult cqlResult) { if (cqlResult == null) { return getNullSize(); } return getThriftEnumSize() + getCollectionSize(cqlResult.getRows(), ThriftObjectSizeUtils::getCqlRowSize) + Integer.BYTES + getCqlMetadataSize(cqlResult.getSchema()); }
.toString(), conn); for (CqlRow row : result.getRows())
.getBytes()), Compression.NONE, ConsistencyLevel.ONE); List<CqlRow> cqlRows = cqlResult.getRows(); CqlRow cqlRow = cqlRows.get(0); .getBytes()), Compression.NONE, ConsistencyLevel.ONE); cqlRows = cqlResult.getRows(); cqlRows = cqlResult.getRows(); cqlRow = cqlRows.get(0); cqlRows = cqlResult.getRows(); cqlRow = cqlRows.get(0); for (Column column : cqlRow.getColumns()) cqlRows = cqlResult.getRows(); cqlRow = cqlRows.get(0); cqlRows = cqlResult.getRows(); try cqlRows = cqlResult.getRows(); cqlRow = cqlRows.get(0); personNameFound = false; cqlRows = cqlResult.getRows(); try
private static List<CellWithTimestamp> getCells(Function<CqlRow, CellWithTimestamp> cellTsExtractor, CqlResult cqlResult) { return cqlResult.getRows() .stream() .map(cellTsExtractor) .collect(Collectors.toList()); }
private static Map<String, byte[]> getRelevantCassandraState( CqlResult casResult, Map<String, Pair<byte[], byte[]>> casMap) { return casResult.getRows().stream() .filter(row -> { String columnName = getColumnNameFromRow(row); return casMap.containsKey(columnName); }) .collect(Collectors.toMap( CassandraTimestampUtils::getColumnNameFromRow, row -> getNamedColumnValue(row.getColumns(), VALUE_COLUMN))); }
public static Map<String, byte[]> getValuesFromSelectionResult(CqlResult result) { return result.getRows().stream() .map(CqlRow::getColumns) .collect(Collectors.toMap( cols -> PtBytes.toString(getNamedColumnValue(cols, COLUMN_NAME_COLUMN)), cols -> getNamedColumnValue(cols, VALUE_COLUMN))); }
@Override public <K, C> Rows<K, C> getRows(ColumnFamily<K, C> columnFamily) { if (!result.isSetRows()) throw new RuntimeException("CQL reponse doesn't contain rows"); return new ThriftCqlRowsImpl<K, C>(result.getRows(), columnFamily.getKeySerializer(), columnFamily.getColumnSerializer()); }
public static long getCqlResultSize(CqlResult cqlResult) { if (cqlResult == null) { return getNullSize(); } return getThriftEnumSize() + getCollectionSize(cqlResult.getRows(), ThriftObjectSizeUtils::getCqlRowSize) + Integer.BYTES + getCqlMetadataSize(cqlResult.getSchema()); }