Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Jun 19, 2024
1 parent 5420747 commit 04aaf92
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 4 additions & 0 deletions velox/docs/functions/spark/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ Array Functions
Returns the size of the array. Returns null for null input if `legacySizeOfNull`
is set to false. Otherwise, returns -1 for null input.

SELECT size(array(1, 2, 3), true); -- 3
SELECT size(NULL, true); -- -1
SELECT size(NULL, false); -- NULL

.. spark:function:: sort_array(array(E)) -> array(E)
Returns an array which has the sorted order of the input array. The elements of array must
Expand Down
4 changes: 4 additions & 0 deletions velox/docs/functions/spark/map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ Map Functions

Returns the size of the input map. Returns null for null input if ``legacySizeOfNull``
is set to false. Otherwise, returns -1 for null input.

SELECT size(map(array(1, 2), array(3, 4)), true); -- 2
SELECT size(NULL, true); -- -1
SELECT size(NULL, false); -- NULL
15 changes: 1 addition & 14 deletions velox/functions/sparksql/Size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,6 @@ struct Size {
legacySizeOfNull_ = *legacySizeOfNull;
}

template <typename TInput>
FOLLY_ALWAYS_INLINE bool callNullable(int32_t& out, const TInput* input) {
if (input == nullptr) {
if (legacySizeOfNull_) {
out = -1;
return true;
} else {
return false;
}
}
out = input->size();
return true;
}

template <typename TInput>
FOLLY_ALWAYS_INLINE bool callNullable(
int32_t& out,
Expand All @@ -70,6 +56,7 @@ struct Size {
}

private:
// If true, returns -1 for null input. Otherwise, returns null.
bool legacySizeOfNull_;
};
} // namespace
Expand Down

0 comments on commit 04aaf92

Please sign in to comment.