Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyangxiaozhu committed Jul 2, 2024
1 parent def37fc commit d210243
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion velox/docs/functions/spark/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Unless specified otherwise, all functions return NULL if at least one of the arg

SELECT ltrim('ps', 'spark'); -- "ark"

.. spark:function:: mask(string, upperChar, lowerChar, digitChar, otherChar) -> string
.. spark:function:: mask(string[, upperChar, lowerChar, digitChar, otherChar]) -> string
Returns a masked version of the input ``string``.
``string``: string value to mask.
Expand Down
11 changes: 5 additions & 6 deletions velox/functions/sparksql/Mask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@
namespace facebook::velox::functions::sparksql {
namespace {
class MaskFunction final : public exec::VectorFunction {
static constexpr std::string_view maskedUpperCase{"X"};
static constexpr std::string_view maskedLowerCase{"x"};
static constexpr std::string_view maskedDigit{"n"};

public:
MaskFunction() {}

void apply(
const SelectivityVector& rows,
std::vector<VectorPtr>& args,
Expand Down Expand Up @@ -179,6 +173,11 @@ class MaskFunction final : public exec::VectorFunction {
}
result.resize(inputSize);
}

private:
static constexpr std::string_view maskedUpperCase{"X"};
static constexpr std::string_view maskedLowerCase{"x"};
static constexpr std::string_view maskedDigit{"n"};
};

std::shared_ptr<exec::VectorFunction> createMask(
Expand Down

0 comments on commit d210243

Please sign in to comment.