Skip to content

Commit

Permalink
HostColumnVectoreCore#isNull should return true for out-of-range rows (
Browse files Browse the repository at this point in the history
…#10779)

This PR suggests a 3VL way of interpreting `isNull` for a `rowId` out of bounds. Such a value is unknown and therefore isNull should be `true`. 

NVIDIA/spark-rapids#5140 shows that `SpecificUnsafeProjection` may probe child columns for NULL even though the parent column row is also NULL. 

However there are no rows in the child CV when the parent row is NULL leading to an assert violation if asserts are enabled or an NPE if disabled.

Signed-off-by: Gera Shegalov <[email protected]>

Authors:
  - Gera Shegalov (https://github.com/gerashegalov)

Approvers:
  - Robert (Bobby) Evans (https://github.com/revans2)

URL: #10779
  • Loading branch information
gerashegalov authored May 6, 2022
1 parent d574c69 commit b12fd56
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions java/src/main/java/ai/rapids/cudf/HostColumnVectorCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,8 @@ public HostColumnVector.StructData getStruct(int rowIndex) {
* @return true if null else false
*/
public boolean isNull(long rowIndex) {
assert (rowIndex >= 0 && rowIndex < rows) : "index is out of range 0 <= " + rowIndex + " < " + rows;
if (hasValidityVector()) {
return BitVectorHelper.isNull(offHeap.valid, rowIndex);
}
return false;
return rowIndex < 0 || rowIndex >= rows // unknown, hence NULL
|| hasValidityVector() && BitVectorHelper.isNull(offHeap.valid, rowIndex);
}

/**
Expand Down

0 comments on commit b12fd56

Please sign in to comment.