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 25, 2024
1 parent 41ed291 commit 34cadf8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
6 changes: 5 additions & 1 deletion velox/docs/functions/spark/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ Array Functions
.. spark:function:: size(array(E), legacySizeOfNull) -> integer
Returns the size of the array. Returns null for null input if `legacySizeOfNull`
is set to false. Otherwise, returns -1 for null input.
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)
Expand Down
6 changes: 5 additions & 1 deletion velox/docs/functions/spark/map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ Map Functions
:noindex:

Returns the size of the input map. Returns null for null input if ``legacySizeOfNull``
is set to false. Otherwise, returns -1 for null input.
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 34cadf8

Please sign in to comment.