diff --git a/velox/expression/ConjunctExpr.h b/velox/expression/ConjunctExpr.h index 5385ca03b8c6..2ad9a1c4fd78 100644 --- a/velox/expression/ConjunctExpr.h +++ b/velox/expression/ConjunctExpr.h @@ -21,6 +21,9 @@ namespace facebook::velox::exec { +constexpr const char* kAnd = "and"; +constexpr const char* kOr = "or"; + class ConjunctExpr : public SpecialForm { public: ConjunctExpr( @@ -31,7 +34,7 @@ class ConjunctExpr : public SpecialForm { : SpecialForm( std::move(type), std::move(inputs), - isAnd ? "and" : "or", + isAnd ? kAnd : kOr, inputsSupportFlatNoNullsFastPath, false /* trackCpuUsage */), isAnd_(isAnd) { diff --git a/velox/expression/RegisterSpecialForm.cpp b/velox/expression/RegisterSpecialForm.cpp index 1de29c58382f..663bcac6ac7d 100644 --- a/velox/expression/RegisterSpecialForm.cpp +++ b/velox/expression/RegisterSpecialForm.cpp @@ -29,21 +29,21 @@ namespace facebook::velox::exec { void registerFunctionCallToSpecialForms() { registerFunctionCallToSpecialForm( - "and", std::make_unique(true /* isAnd */)); + kAnd, std::make_unique(true /* isAnd */)); registerFunctionCallToSpecialForm( - "cast", std::make_unique()); + kCast.str(), std::make_unique()); registerFunctionCallToSpecialForm( - "try_cast", std::make_unique()); + kTryCast.str(), std::make_unique()); registerFunctionCallToSpecialForm( - "coalesce", std::make_unique()); + kCoalesce, std::make_unique()); registerFunctionCallToSpecialForm( - "if", std::make_unique()); + kIf, std::make_unique()); registerFunctionCallToSpecialForm( - "or", std::make_unique(false /* isAnd */)); + kOr, std::make_unique(false /* isAnd */)); registerFunctionCallToSpecialForm( - "switch", std::make_unique()); + kSwitch, std::make_unique()); registerFunctionCallToSpecialForm( - "try", std::make_unique()); + kTry, std::make_unique()); registerFunctionCallToSpecialForm( RowConstructorCallToSpecialForm::kRowConstructor, std::make_unique()); diff --git a/velox/expression/SwitchExpr.h b/velox/expression/SwitchExpr.h index cddbcbce64b8..e5c9bf0f27b2 100644 --- a/velox/expression/SwitchExpr.h +++ b/velox/expression/SwitchExpr.h @@ -20,6 +20,9 @@ namespace facebook::velox::exec { +constexpr const char* kIf = "if"; +constexpr const char* kSwitch = "switch"; + /// CASE expression: /// /// case diff --git a/velox/expression/TryExpr.h b/velox/expression/TryExpr.h index 9dc80e40f5da..1cc86cce5726 100644 --- a/velox/expression/TryExpr.h +++ b/velox/expression/TryExpr.h @@ -20,6 +20,8 @@ namespace facebook::velox::exec { +constexpr const char* kTry = "try"; + class TryExpr : public SpecialForm { public: /// Try expression adds nulls, hence, doesn't support flat-no-nulls fast path. @@ -27,7 +29,7 @@ class TryExpr : public SpecialForm { : SpecialForm( std::move(type), {std::move(input)}, - "try", + kTry, false /* supportsFlatNoNullsFastPath */, false /* trackCpuUsage */) {}