Jackie-Jiang commented on code in PR #13591:
URL: https://github.com/apache/pinot/pull/13591#discussion_r1678283038
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/FilterOperator.java:
##########
@@ -96,20 +96,21 @@ public String toExplainString() {
@Override
protected TransferableBlock getNextBlock() {
TransferableBlock block = _input.nextBlock();
- if (block.isEndOfStreamBlock()) {
- if (block.isErrorBlock()) {
- return block;
- }
+ if (block.isErrorBlock()) {
+ return block;
+ }
+ if (block.isSuccessfulEndOfStreamBlock()) {
return updateEosBlock(block, _statMap);
}
- List<Object[]> resultRows = new ArrayList<>();
+ assert block.isDataBlock();
+ List<Object[]> rows = new ArrayList<>();
for (Object[] row : block.getContainer()) {
Object filterResult = _filterOperand.apply(row);
if (BooleanUtils.isTrueInternalValue(filterResult)) {
- resultRows.add(row);
+ rows.add(row);
}
}
- return new TransferableBlock(resultRows, _dataSchema, DataBlock.Type.ROW);
+ return rows.isEmpty() ? getNextBlock() : new TransferableBlock(rows,
_dataSchema, DataBlock.Type.ROW);
Review Comment:
No. Basically we want to skip the empty block, until we find an non-empty
block, or finished all data. Noted that we can get empty block when all rows in
upstream block is filtered out.
Let me make it a while loop which is probably easier to understand
--
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]