From 62355d0b949b4b849c8a43b93f5c1fbaf16d2eca Mon Sep 17 00:00:00 2001 From: PHILO-HE Date: Thu, 6 Jun 2024 23:04:33 +0800 Subject: [PATCH] Fix comment --- velox/docs/functions/spark/string.rst | 4 ++-- velox/functions/sparksql/String.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/velox/docs/functions/spark/string.rst b/velox/docs/functions/spark/string.rst index a9e9f70569db..e340bd1977ad 100644 --- a/velox/docs/functions/spark/string.rst +++ b/velox/docs/functions/spark/string.rst @@ -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``, separated by ``separator``. The type of ``separator`` is VARCHAR . It can take variable number of - remaining arguments, where ``string`` & ``array`` can be used in combination. NULL + remaining arguments, where ``string`` and ``array`` 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' diff --git a/velox/functions/sparksql/String.cpp b/velox/functions/sparksql/String.cpp index 7b6d8ec44d97..1601e614dfd2 100644 --- a/velox/functions/sparksql/String.cpp +++ b/velox/functions/sparksql/String.cpp @@ -432,7 +432,7 @@ std::vector> concatWsSignatures() { // varchar, [varchar], [array(varchar)], ... -> varchar. exec::FunctionSignatureBuilder() .returnType("varchar") - .constantArgumentType("varchar") + .argumentType("varchar") .argumentType("any") .variableArity() .build()}; @@ -457,11 +457,11 @@ std::shared_ptr makeConcatWs( arg.type->toString()); } - BaseVector* constantPattern = inputArgs[0].constantValue.get(); + BaseVector* constantSeparator = inputArgs[0].constantValue.get(); std::optional separator = std::nullopt; - if (constantPattern != nullptr) { + if (constantSeparator != nullptr) { separator = - constantPattern->as>()->valueAt(0).str(); + constantSeparator->as>()->valueAt(0).str(); } return std::make_shared(separator);