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


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/HashJoinOperator.java:
##########
@@ -101,27 +114,32 @@ private void buildBroadcastHashTable() {
         }
         rightBlock = _rightTableOperator.nextBlock();
       }
+      if (rightBlock.isErrorBlock()) {
+        _upstreamErrorBlock = (MetadataBlock) rightBlock.getDataBlock();
+      }
       _isHashTableBuilt = true;
     }
   }
 
   private TransferableBlock buildJoinedDataBlock(TransferableBlock leftBlock)
       throws Exception {
-    if (TransferableBlockUtils.isEndOfStream(leftBlock)) {
-      return TransferableBlockUtils.getEndOfStreamTransferableBlock();
-    }
-    List<Object[]> rows = new ArrayList<>();
-    _leftTableSchema = leftBlock.getDataSchema();
-    _resultRowSize = _leftTableSchema.size() + _rightTableSchema.size();
-    List<Object[]> container = leftBlock.getContainer();
-    for (Object[] leftRow : container) {
-      List<Object[]> hashCollection =
-          
_broadcastHashTable.getOrDefault(_leftKeySelector.computeHash(leftRow), 
Collections.emptyList());
-      for (Object[] rightRow : hashCollection) {
-        rows.add(joinRow(leftRow, rightRow));
+    if (!TransferableBlockUtils.isEndOfStream(leftBlock)) {
+      List<Object[]> rows = new ArrayList<>();
+      List<Object[]> container = leftBlock.getContainer();
+      for (Object[] leftRow : container) {
+        List<Object[]> hashCollection = _broadcastHashTable.getOrDefault(
+            _leftKeySelector.computeHash(leftRow), Collections.emptyList());
+        for (Object[] rightRow : hashCollection) {
+          rows.add(joinRow(leftRow, rightRow));
+        }
       }
+      return new TransferableBlock(rows, computeSchema(), 
BaseDataBlock.Type.ROW);
+    } else if (leftBlock.isErrorBlock()) {
+      _upstreamErrorBlock = (MetadataBlock) leftBlock.getDataBlock();
+      return TransferableBlockUtils.repackErrorBlock(_upstreamErrorBlock);
+    } else {
+      return new 
TransferableBlock(DataBlockUtils.getEmptyDataBlock(_resultSchema));

Review Comment:
   If we reach here should we assert that leftBlock is a `EOS` type `METADATA` 
block ?



-- 
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