Skip to content

Commit

Permalink
Emphasize that ContainerRowSerde::compare does not allow top level nu…
Browse files Browse the repository at this point in the history
…lls. (#6820)

Summary:
Pull Request resolved: #6820

ContainerRowSerde::compare does not allow top level nulls, made that explicit using a comment and a DCHECK.

Reviewed By: mbasmanova

Differential Revision: D49775400

fbshipit-source-id: ecd7b2043067147455a4993d9eddb2deb736b865
  • Loading branch information
laithsakka authored and facebook-github-bot committed Sep 29, 2023
1 parent 1c2097a commit df1eb1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions velox/exec/ContainerRowSerde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ int32_t ContainerRowSerde::compare(
const DecodedVector& right,
vector_size_t index,
CompareFlags flags) {
VELOX_DCHECK(
!right.isNullAt(index), "Null top-level values are not supported");
VELOX_DCHECK(!flags.mayStopAtNull(), "not supported null handling mode");
return compareSwitch(left, *right.base(), right.index(index), flags).value();
}
Expand All @@ -817,6 +819,8 @@ std::optional<int32_t> ContainerRowSerde::compareWithNulls(
const DecodedVector& right,
vector_size_t index,
CompareFlags flags) {
VELOX_DCHECK(
!right.isNullAt(index), "Null top-level values are not supported");
return compareSwitch(left, *right.base(), right.index(index), flags);
}

Expand Down
2 changes: 2 additions & 0 deletions velox/exec/ContainerRowSerde.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ContainerRowSerde {
/// Returns < 0 if 'left' is less than 'right' at 'index', 0 if
/// equal and > 0 otherwise. flags.nullHandlingMode can be only NoStop and
/// support null-safe equal.
/// Top level rows in right are not allowed to be null.
static int32_t compare(
ByteStream& left,
const DecodedVector& right,
Expand All @@ -55,6 +56,7 @@ class ContainerRowSerde {
/// returns std::nullopt if either 'left' or 'right' value is null or contains
/// a null. If flags.nullHandlingMode is NoStop then NULL is considered equal
/// to NULL.
/// Top level rows in right are not allowed to be null.
static std::optional<int32_t> compareWithNulls(
ByteStream& left,
const DecodedVector& right,
Expand Down

0 comments on commit df1eb1b

Please sign in to comment.