Skip to content

Commit

Permalink
Minor optimisation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppanopticon committed Dec 19, 2023
1 parent 9057fee commit 6edb7dc
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ internal interface TransactionalGrpcService {
LOGGER.info("[{}, {}] Execution of {} completed successfully in {}.", context.txn.transactionId, context.queryId, context.physical.firstOrNull()?.name, m2.elapsedNow())
}.collect {
val tuple = it.toTuple()
results += 1
if (accumulatedSize + tuple.serializedSize >= Constants.MAX_PAGE_SIZE_BYTES) {
val tupleSize = tuple.serializedSize
if (accumulatedSize + tupleSize >= Constants.MAX_PAGE_SIZE_BYTES) {
responseBuilder.metadataBuilder.planDuration = m2.elapsedNow().toLong(DurationUnit.MILLISECONDS) /* Query duration is, re-evaluated for every batch. */
emit(responseBuilder.build())
responseBuilder.clearTuples()
Expand All @@ -202,7 +202,8 @@ internal interface TransactionalGrpcService {

/* Add entry to page and increment counter. */
responseBuilder.addTuples(tuple)
accumulatedSize += tuple.serializedSize
accumulatedSize += tupleSize
results += 1
}
}

Expand Down

0 comments on commit 6edb7dc

Please sign in to comment.