walterddr commented on code in PR #10711:
URL: https://github.com/apache/pinot/pull/10711#discussion_r1188873743
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/LeafStageTransferableBlockOperator.java:
##########
@@ -93,27 +93,39 @@ public String toExplainString() {
@Override
protected TransferableBlock getNextBlock() {
- if (_currentIndex < 0) {
+ if (_errorBlock != null) {
throw new RuntimeException("Leaf transfer terminated. next block should
no longer be called.");
}
- if (_errorBlock != null) {
- _currentIndex = -1;
+ // runLeafStage
+ InstanceResponseBlock responseBlock = getNextBlockFromLeafStage();
+ if (responseBlock == null) {
+ // finished getting next block from leaf stage. returning EOS
+ return new TransferableBlock(DataBlockUtils.getEndOfStreamDataBlock());
+ } else if (!responseBlock.getExceptions().isEmpty()) {
+ // get error from leaf stage, return ERROR
+ _errorBlock = responseBlock;
return new
TransferableBlock(DataBlockUtils.getErrorDataBlock(_errorBlock.getExceptions()));
} else {
- if (_currentIndex < _baseResultBlock.size()) {
- InstanceResponseBlock responseBlock =
_baseResultBlock.get(_currentIndex++);
- if (responseBlock.getResultsBlock() != null &&
responseBlock.getResultsBlock().getNumRows() > 0) {
- return composeTransferableBlock(responseBlock, _desiredDataSchema);
- } else {
- return new TransferableBlock(Collections.emptyList(),
_desiredDataSchema, DataBlock.Type.ROW);
- }
+ // return normal block.
+ OperatorStats operatorStats = _opChainStats.getOperatorStats(_context,
getOperatorId());
+ operatorStats.recordExecutionStats(responseBlock.getResponseMetadata());
+ if (responseBlock.getResultsBlock() != null &&
responseBlock.getResultsBlock().getNumRows() > 0) {
+ return composeTransferableBlock(responseBlock, _desiredDataSchema);
} else {
- _currentIndex = -1;
- return new TransferableBlock(DataBlockUtils.getEndOfStreamDataBlock());
+ return new TransferableBlock(Collections.emptyList(),
_desiredDataSchema, DataBlock.Type.ROW);
}
}
}
+ private @Nullable InstanceResponseBlock getNextBlockFromLeafStage() {
+ if (!_serverQueryRequestQueue.isEmpty()) {
+ ServerQueryRequest request = _serverQueryRequestQueue.pop();
+ return _processCall.apply(request);
+ } else {
+ return null;
+ }
Review Comment:
this should be asynchronously submitted and awaits data return for a full
opChain style execution. but will follow up once we create a more concrete
execution/yielding framework
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]