songwdfu commented on code in PR #16152:
URL: https://github.com/apache/pinot/pull/16152#discussion_r2157221954


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/BaseJoinOperator.java:
##########
@@ -376,4 +382,126 @@ public StatMap.Type getType() {
       return _type;
     }
   }
+
+  /**
+   * This util class is a view over the left and right row joined together
+   * currently this is used for filtering and input of projection. So if the 
joined
+   * tuple doesn't pass the predicate, the join result is not materialized 
into Object[].
+   *
+   * It is debatable whether we always want to use this instead of copying the 
tuple
+   */
+  private abstract static class JoinedRowView extends AbstractList<Object> 
implements List<Object> {
+    protected final int _leftSize;
+    protected final int _size;
+
+    protected JoinedRowView(int resultColumnSize, int leftSize) {
+      _leftSize = leftSize;
+      _size = resultColumnSize;
+    }
+
+    private static final class NullNullView extends JoinedRowView {
+      public NullNullView(int resultColumnSize, int leftSize) {
+        super(resultColumnSize, leftSize);
+      }
+
+      @Override
+      public Object get(int i) {
+        return null;
+      }
+
+      @Override
+      @NotNull
+      public Object[] toArray() {
+        return new Object[_size];
+      }
+    }
+
+    private static final class LeftRightView extends JoinedRowView {
+      private final Object[] _leftRow;
+      private final Object[] _rightRow;
+
+      private LeftRightView(Object[] leftRow, Object[] rightRow, int 
resultColumnSize, int leftSize) {
+        super(resultColumnSize, leftSize);
+        _leftRow = leftRow;
+        _rightRow = rightRow;
+      }
+
+      @Override
+      public Object get(int i) {
+        return i < _leftSize ? _leftRow[i] : _rightRow[i - _leftSize];
+      }
+
+      @Override
+      @NotNull
+      public Object[] toArray() {
+        Object[] resultRow = new Object[_size];
+        System.arraycopy(_leftRow, 0, resultRow, 0, _leftSize);
+        System.arraycopy(_rightRow, 0, resultRow, _leftSize, _rightRow.length);
+        return resultRow;
+      }
+    }
+
+    private static final class NullRightView extends JoinedRowView {
+      private final Object[] _rightRow;
+
+      public NullRightView(Object[] rightRow, int resultColumnSize, int 
leftSize) {
+        super(resultColumnSize, leftSize);
+        _rightRow = rightRow;
+      }
+
+      @Override
+      public Object get(int i) {
+        return i < _leftSize ? null : _rightRow[i - _leftSize];
+      }
+
+      @Override
+      @NotNull
+      public Object[] toArray() {
+        Object[] resultRow = new Object[_size];
+        System.arraycopy(_rightRow, 0, resultRow, _leftSize, _rightRow.length);
+        return resultRow;
+      }
+    }
+
+    private static final class LeftNullView extends JoinedRowView {

Review Comment:
   Renamed to LeftNotNullView, RightNotNullView, and BothNotNullView



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

Reply via email to