siddharthteotia commented on code in PR #9064:
URL: https://github.com/apache/pinot/pull/9064#discussion_r927832301


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/blocks/TransferableBlock.java:
##########
@@ -97,10 +122,38 @@ public BaseDataBlock getDataBlock() {
     return _dataBlock;
   }
 
+  /**
+   * Return the type of block (one of ROW, COLUMNAR, or METADATA).
+   *
+   * @return return type of block
+   */
   public BaseDataBlock.Type getType() {
     return _type;
   }
 
+  /**
+   * Return whether a transferable block is at the end of a stream.
+   *
+   * <p>End of stream is different from data block with 0-rows. which can 
indicate that one partition of the execution
+   * returns no rows. but that doesn't mean the rest of the partitions are 
also finished.
+   * <p>When an exception is caught within a stream, no matter how many 
outstanding data is pending to be received,
+   * it is considered end of stream because the exception should bubble up 
immediately.
+   *
+   * @return whether this block is the end of stream.
+   */
+  public boolean isEndOfStreamBlock() {
+    return _isErrorBlock || _type == BaseDataBlock.Type.METADATA;

Review Comment:
   This condition is not very intuitive.
   
   - In both cases (eos or error), the block is a metadata block
   - The block should be self-descriptive and tell if the metadata block is eos 
or error.
   - The 2nd condition reads as "if it is not a error block but a metadata 
block, it is a eos block". This may not hold true in future if leverage 
metadata block for some other reasons. So we can have a simple flag /bit to 
indicate which kind of metadata block it is



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to