/** * 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 List<ByteBuffer> getOutputRow() { List<ByteBuffer> outputRow = selectors.getOutputRow(protocolVersion); if (isJson) { // Keep all columns around for possible post-query ordering. (CASSANDRA-14286) List<ByteBuffer> jsonRow = rowToJson(outputRow, protocolVersion, metadata); // Keep ordering columns around for possible post-query ordering. (CASSANDRA-14286) if (orderingIndex != null) { for (Integer orderingColumnIndex : orderingIndex.values()) jsonRow.add(outputRow.get(orderingColumnIndex)); } outputRow = jsonRow; } return outputRow; } }
/** * 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); }
/** * 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; }
/** * 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 List<ByteBuffer> getOutputRow() { List<ByteBuffer> outputRow = selectors.getOutputRow(protocolVersion); if (isJson) { // Keep all columns around for possible post-query ordering. (CASSANDRA-14286) List<ByteBuffer> jsonRow = rowToJson(outputRow, protocolVersion, metadata); // Keep ordering columns around for possible post-query ordering. (CASSANDRA-14286) if (orderingIndex != null) { for (Integer orderingColumnIndex : orderingIndex.values()) jsonRow.add(outputRow.get(orderingColumnIndex)); } outputRow = jsonRow; } return outputRow; } }
/** * 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 List<ByteBuffer> getOutputRow() { List<ByteBuffer> outputRow = selectors.getOutputRow(protocolVersion); return isJson ? rowToJson(outputRow, protocolVersion, metadata) : outputRow; } }