From 2ef9a07f30f1fdf1881d17c8fd34fb95daf07ae2 Mon Sep 17 00:00:00 2001 From: PHILO-HE Date: Mon, 26 Feb 2024 20:48:17 +0800 Subject: [PATCH] Change name: use separator instead --- velox/functions/sparksql/String.cpp | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/velox/functions/sparksql/String.cpp b/velox/functions/sparksql/String.cpp index 8d515f648aa7..567fc6721f56 100644 --- a/velox/functions/sparksql/String.cpp +++ b/velox/functions/sparksql/String.cpp @@ -107,7 +107,7 @@ void concatWsVariableParameters( const SelectivityVector& rows, std::vector& args, exec::EvalCtx& context, - const std::string& connector, + const std::string& separator, FlatVector& flatResult) { std::vector argMapping; std::vector constantStrings; @@ -131,7 +131,7 @@ void concatWsVariableParameters( break; } - value += connector + + value += separator + args[j]->as>()->valueAt(0).str(); } constantStrings.push_back(std::string(value.data(), value.size())); @@ -173,7 +173,7 @@ void concatWsVariableParameters( if (isFirst) { isFirst = false; } else { - totalResultBytes += connector.size(); + totalResultBytes += separator.size(); } totalResultBytes += value.size(); } @@ -199,9 +199,9 @@ void concatWsVariableParameters( if (isFirst) { isFirst = false; } else { - memcpy(rawBuffer + offset, connector.data(), connector.size()); - offset += connector.size(); - combinedSize += connector.size(); + memcpy(rawBuffer + offset, separator.data(), separator.size()); + offset += separator.size(); + combinedSize += separator.size(); } memcpy(rawBuffer + offset, value.data(), size); combinedSize += size; @@ -216,7 +216,7 @@ void concatWsArray( const SelectivityVector& rows, std::vector& args, exec::EvalCtx& context, - const std::string& connector, + const std::string& separator, FlatVector& flatResult) { exec::LocalDecodedVector arrayHolder(context, *args[1], rows); auto& arrayDecoded = *arrayHolder.get(); @@ -246,7 +246,7 @@ void concatWsArray( if (isFirst) { isFirst = false; } else { - totalResultBytes += connector.size(); + totalResultBytes += separator.size(); } totalResultBytes += element.size(); } @@ -272,9 +272,9 @@ void concatWsArray( isFirst = false; } else { memcpy( - rawBuffer + bufferOffset, connector.data(), connector.size()); - bufferOffset += connector.size(); - combinedSize += connector.size(); + rawBuffer + bufferOffset, separator.data(), separator.size()); + bufferOffset += separator.size(); + combinedSize += separator.size(); } memcpy(rawBuffer + bufferOffset, element.data(), element.size()); bufferOffset += element.size(); @@ -288,7 +288,7 @@ void concatWsArray( class ConcatWs : public exec::VectorFunction { public: - explicit ConcatWs(const std::string& connector) : connector_(connector) {} + explicit ConcatWs(const std::string& separator) : separator_(separator) {} bool isDefaultNullBehavior() const override { return false; @@ -317,15 +317,15 @@ class ConcatWs : public exec::VectorFunction { auto arrayArgs = args[1]->typeKind() == TypeKind::ARRAY; if (arrayArgs) { - concatWsArray(selected, args, context, connector_, *flatResult); + concatWsArray(selected, args, context, separator_, *flatResult); } else { concatWsVariableParameters( - selected, args, context, connector_, *flatResult); + selected, args, context, separator_, *flatResult); } } private: - const std::string connector_; + const std::string separator_; }; } // namespace @@ -400,11 +400,11 @@ std::shared_ptr makeConcatWs( BaseVector* constantPattern = inputArgs[0].constantValue.get(); VELOX_USER_CHECK( nullptr != constantPattern, - "concat_ws requires constant connector arguments."); + "concat_ws requires constant separator arguments."); - auto connector = + auto separator = constantPattern->as>()->valueAt(0).str(); - return std::make_shared(connector); + return std::make_shared(separator); } void encodeDigestToBase16(uint8_t* output, int digestSize) {