diff --git a/velox/expression/FunctionSignature.cpp b/velox/expression/FunctionSignature.cpp index f4cd3530cafd9..6e470e4f0c1c5 100644 --- a/velox/expression/FunctionSignature.cpp +++ b/velox/expression/FunctionSignature.cpp @@ -93,14 +93,6 @@ size_t findNextComma(const std::string& str, size_t start) { } namespace { -/// Returns true only if 'str' contains digits. -bool isPositiveInteger(const std::string& str) { - return !str.empty() && - std::find_if(str.begin(), str.end(), [](unsigned char c) { - return !std::isdigit(c); - }) == str.end(); -} - void validateBaseTypeAndCollectTypeParams( const std::unordered_map& variables, const TypeSignature& arg, diff --git a/velox/expression/SignatureBinder.cpp b/velox/expression/SignatureBinder.cpp index 4ea670d4d1951..784ac1b5f4070 100644 --- a/velox/expression/SignatureBinder.cpp +++ b/velox/expression/SignatureBinder.cpp @@ -27,14 +27,6 @@ bool isAny(const TypeSignature& typeSignature) { return typeSignature.baseName() == "any"; } -/// Returns true only if 'str' contains digits. -bool isPositiveInteger(const std::string& str) { - return !str.empty() && - std::find_if(str.begin(), str.end(), [](unsigned char c) { - return !std::isdigit(c); - }) == str.end(); -} - std::string buildCalculation( const std::string& variable, const std::string& calculation) { diff --git a/velox/expression/tests/utils/ArgumentTypeFuzzer.cpp b/velox/expression/tests/utils/ArgumentTypeFuzzer.cpp index 1b32b5c946746..f140499e71a41 100644 --- a/velox/expression/tests/utils/ArgumentTypeFuzzer.cpp +++ b/velox/expression/tests/utils/ArgumentTypeFuzzer.cpp @@ -45,15 +45,6 @@ bool isDecimalBaseName(const std::string& typeName) { return normalized == "decimal"; } - -/// Returns true only if 'str' contains digits. -bool isPositiveInteger(const std::string& str) { - return !str.empty() && - std::find_if(str.begin(), str.end(), [](unsigned char c) { - return !std::isdigit(c); - }) == str.end(); -} - } // namespace void ArgumentTypeFuzzer::determineUnboundedIntegerVariables( diff --git a/velox/type/fbhive/HiveTypeParser.cpp b/velox/type/fbhive/HiveTypeParser.cpp index 331aacc854ba7..1a3855fc2bac9 100644 --- a/velox/type/fbhive/HiveTypeParser.cpp +++ b/velox/type/fbhive/HiveTypeParser.cpp @@ -27,13 +27,6 @@ using facebook::velox::Type; using facebook::velox::TypeKind; namespace { -/// Returns true only if 'str' contains digits. -bool isPositiveInteger(const std::string& str) { - return !str.empty() && - std::find_if(str.begin(), str.end(), [](unsigned char c) { - return !std::isdigit(c); - }) == str.end(); -} bool isSupportedSpecialChar(char c) { static std::unordered_set supported{'_', '$', '#'}; diff --git a/velox/type/parser/ParserUtil.cpp b/velox/type/parser/ParserUtil.cpp index b7fa36ec27b9b..b47a1970bbbf2 100644 --- a/velox/type/parser/ParserUtil.cpp +++ b/velox/type/parser/ParserUtil.cpp @@ -52,4 +52,11 @@ std::pair> inferTypeWithSpaces( fieldName, typeFromString(allWords.substr(fieldName.size() + 1))); } + +bool isPositiveInteger(const std::string& str) { + return !str.empty() && + std::find_if(str.begin(), str.end(), [](unsigned char c) { + return !std::isdigit(c); + }) == str.end(); +} } // namespace facebook::velox diff --git a/velox/type/parser/ParserUtil.h b/velox/type/parser/ParserUtil.h index 7906b8bbf29d6..4d2d097bf4a31 100644 --- a/velox/type/parser/ParserUtil.h +++ b/velox/type/parser/ParserUtil.h @@ -36,4 +36,7 @@ std::pair inferTypeWithSpaces( std::vector& words, bool cannotHaveFieldName = false); +/// Returns true only if 'str' contains digits. +bool isPositiveInteger(const std::string& str); + } // namespace facebook::velox