FBUtilities.nowInSeconds()); return builder.build();
/** * Notifies this <code>Builder</code> that a new row is being processed. * * @param partitionKey the partition key of the new row * @param clustering the clustering of the new row */ public void newRow(DecoratedKey partitionKey, Clustering clustering) { // The groupMaker needs to be called for each row boolean isNewAggregate = groupMaker == null || groupMaker.isNewGroup(partitionKey, clustering); if (current != null) { selectors.addInputRow(protocolVersion, this); if (isNewAggregate) { resultSet.addRow(getOutputRow()); selectors.reset(); } } current = new ArrayList<>(columns.size()); // Timestamps and TTLs are arrays per row, we must null them out between rows if (timestamps != null) Arrays.fill(timestamps, Long.MIN_VALUE); if (ttls != null) Arrays.fill(ttls, -1); }
public void add(Cell c, int nowInSec) { if (c == null) { current.add(null); return; } current.add(value(c)); if (timestamps != null) timestamps[current.size() - 1] = c.timestamp(); if (ttls != null) ttls[current.size() - 1] = remainingTTL(c, nowInSec); }
result.newRow(partition.partitionKey(), staticRow.clustering()); for (ColumnDefinition def : selection.getColumns()) result.add(keyComponents[def.position()]); break; case STATIC: break; default: result.add((ByteBuffer)null); result.newRow( partition.partitionKey(), row.clustering()); result.add(keyComponents[def.position()]); break; case CLUSTERING: result.add(row.clustering().get(def.position())); break; case REGULAR:
result.newRow(partition.partitionKey(), staticRow.clustering()); for (ColumnDefinition def : selection.getColumns()) result.add(keyComponents[def.position()]); break; case STATIC: break; default: result.add((ByteBuffer)null); result.newRow( partition.partitionKey(), row.clustering()); result.add(keyComponents[def.position()]); break; case CLUSTERING: result.add(row.clustering().get(def.position())); break; case REGULAR:
result.newRow(partition.partitionKey(), staticRow.clustering()); for (ColumnDefinition def : selection.getColumns()) result.add(keyComponents[def.position()]); break; case STATIC: break; default: result.add((ByteBuffer)null); result.newRow( partition.partitionKey(), row.clustering()); result.add(keyComponents[def.position()]); break; case CLUSTERING: result.add(row.clustering().get(def.position())); break; case REGULAR:
FBUtilities.nowInSeconds()); return builder.build();
FBUtilities.nowInSeconds()); return builder.build();
/** * Notifies this <code>Builder</code> that a new row is being processed. * * @param partitionKey the partition key of the new row * @param clustering the clustering of the new row */ public void newRow(DecoratedKey partitionKey, Clustering clustering) { // The groupMaker needs to be called for each row boolean isNewAggregate = groupMaker == null || groupMaker.isNewGroup(partitionKey, clustering); if (current != null) { selectors.addInputRow(protocolVersion, this); if (isNewAggregate) { resultSet.addRow(getOutputRow()); selectors.reset(); } } current = new ArrayList<>(columns.size()); // Timestamps and TTLs are arrays per row, we must null them out between rows if (timestamps != null) Arrays.fill(timestamps, Long.MIN_VALUE); if (ttls != null) Arrays.fill(ttls, -1); }
/** * Notifies this <code>Builder</code> that a new row is being processed. * * @param partitionKey the partition key of the new row * @param clustering the clustering of the new row */ public void newRow(DecoratedKey partitionKey, Clustering clustering) { // The groupMaker needs to be called for each row boolean isNewAggregate = groupMaker == null || groupMaker.isNewGroup(partitionKey, clustering); if (current != null) { selectors.addInputRow(protocolVersion, this); if (isNewAggregate) { resultSet.addRow(getOutputRow()); selectors.reset(); } } current = new ArrayList<>(columns.size()); // Timestamps and TTLs are arrays per row, we must null them out between rows if (timestamps != null) Arrays.fill(timestamps, Long.MIN_VALUE); if (ttls != null) Arrays.fill(ttls, -1); }
private static void addValue(Selection.ResultSetBuilder result, ColumnDefinition def, Row row, int nowInSec, ProtocolVersion protocolVersion) { if (def.isComplex()) { assert def.type.isMultiCell(); ComplexColumnData complexData = row.getComplexColumnData(def); if (complexData == null) result.add(null); else if (def.type.isCollection()) result.add(((CollectionType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); else result.add(((UserType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); } else { result.add(row.getCell(def), nowInSec); } }
/** * Builds the <code>ResultSet</code> */ public ResultSet build() { if (current != null) { selectors.addInputRow(protocolVersion, this); resultSet.addRow(getOutputRow()); selectors.reset(); current = null; } // For aggregates we need to return a row even it no records have been found if (resultSet.isEmpty() && groupMaker != null && groupMaker.returnAtLeastOneRow()) resultSet.addRow(getOutputRow()); return resultSet; }
private ResultSet process(PartitionIterator partitions, QueryOptions options, int nowInSec, int userLimit) throws InvalidRequestException { Selection.ResultSetBuilder result = selection.resultSetBuilder(options, parameters.isJson, aggregationSpec); while (partitions.hasNext()) { try (RowIterator partition = partitions.next()) { processPartition(partition, options, result, nowInSec); } } ResultSet cqlRows = result.build(); orderResults(cqlRows); cqlRows.trim(userLimit); return cqlRows; }
private static void addValue(Selection.ResultSetBuilder result, ColumnDefinition def, Row row, int nowInSec, ProtocolVersion protocolVersion) { if (def.isComplex()) { assert def.type.isMultiCell(); ComplexColumnData complexData = row.getComplexColumnData(def); if (complexData == null) result.add(null); else if (def.type.isCollection()) result.add(((CollectionType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); else result.add(((UserType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); } else { result.add(row.getCell(def), nowInSec); } }
private static void addValue(Selection.ResultSetBuilder result, ColumnDefinition def, Row row, int nowInSec, ProtocolVersion protocolVersion) { if (def.isComplex()) { assert def.type.isMultiCell(); ComplexColumnData complexData = row.getComplexColumnData(def); if (complexData == null) result.add(null); else if (def.type.isCollection()) result.add(((CollectionType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); else result.add(((UserType) def.type).serializeForNativeProtocol(complexData.iterator(), protocolVersion)); } else { result.add(row.getCell(def), nowInSec); } }
private ResultSet process(PartitionIterator partitions, QueryOptions options, int nowInSec, int userLimit) throws InvalidRequestException { Selection.ResultSetBuilder result = selection.resultSetBuilder(options, parameters.isJson, aggregationSpec); while (partitions.hasNext()) { try (RowIterator partition = partitions.next()) { processPartition(partition, options, result, nowInSec); } } ResultSet cqlRows = result.build(); orderResults(cqlRows); cqlRows.trim(userLimit); return cqlRows; }
private ResultSet process(PartitionIterator partitions, QueryOptions options, int nowInSec, int userLimit) throws InvalidRequestException { Selection.ResultSetBuilder result = selection.resultSetBuilder(options, parameters.isJson, aggregationSpec); while (partitions.hasNext()) { try (RowIterator partition = partitions.next()) { processPartition(partition, options, result, nowInSec); } } ResultSet cqlRows = result.build(); orderResults(cqlRows); cqlRows.trim(userLimit); return cqlRows; }