abstract protected MutationState mutate(StatementContext context, ResultIterator iterator, PhoenixConnection connection) throws SQLException;
@Override
public PeekingResultIterator newIterator(StatementContext context, ResultIterator iterator, Scan scan) throws SQLException {
final PhoenixConnection connection = new PhoenixConnection(this.connection);
MutationState state = mutate(context, iterator, connection);
long totalRowCount = state.getUpdateCount();
if (connection.getAutoCommit()) {
connection.getMutationState().join(state);
connection.commit();
ConnectionQueryServices services = connection.getQueryServices();
int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
state = new MutationState(maxSize, connection, totalRowCount);
}
final MutationState finalState = state;
byte[] value = PDataType.LONG.toBytes(totalRowCount);
KeyValue keyValue = KeyValueUtil.newKeyValue(UNGROUPED_AGG_ROW_KEY, SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, AGG_TIMESTAMP, value, 0, value.length);
final Tuple tuple = new SingleKeyValueTuple(keyValue);
return new PeekingResultIterator() {
private boolean done = false;