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 6, 2024
1 parent 5c89648 commit c21b1ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions velox/docs/functions/spark/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Unless specified otherwise, all functions return NULL if at least one of the arg
Returns the concatenation for ``string`` and all elements in ``array<string>``, separated
by ``separator``. The type of ``separator`` is VARCHAR . It can take variable number of
remaining arguments, where ``string`` & ``array<string>`` can be used in combination. NULL
remaining arguments, where ``string`` and ``array<string>`` can be used in combination. NULL
element is skipped in the concatenation. If ``separator`` is NULL, returns NULL, regardless
of the followinginputs. For non-NULL ``separator``, if no remaining input or all remaining
of the following inputs. For non-NULL ``separator``, if no remaining input or all remaining
inputs are NULL, returns an empty string. ::

SELECT concat_ws('~', 'a', 'b', 'c'); -- 'a~b~c'
Expand Down
8 changes: 4 additions & 4 deletions velox/functions/sparksql/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ std::vector<std::shared_ptr<exec::FunctionSignature>> concatWsSignatures() {
// varchar, [varchar], [array(varchar)], ... -> varchar.
exec::FunctionSignatureBuilder()
.returnType("varchar")
.constantArgumentType("varchar")
.argumentType("varchar")
.argumentType("any")
.variableArity()
.build()};
Expand All @@ -457,11 +457,11 @@ std::shared_ptr<exec::VectorFunction> makeConcatWs(
arg.type->toString());
}

BaseVector* constantPattern = inputArgs[0].constantValue.get();
BaseVector* constantSeparator = inputArgs[0].constantValue.get();
std::optional<std::string> separator = std::nullopt;
if (constantPattern != nullptr) {
if (constantSeparator != nullptr) {
separator =
constantPattern->as<ConstantVector<StringView>>()->valueAt(0).str();
constantSeparator->as<ConstantVector<StringView>>()->valueAt(0).str();
}

return std::make_shared<ConcatWs>(separator);
Expand Down

0 comments on commit c21b1ed

Please sign in to comment.