795 if (!arg_expr->get_type_info().is_string()) {
796 throw std::runtime_error(
"expression before REGEXP must be of a string type.");
798 if (!pattern_expr->get_type_info().is_string()) {
799 throw std::runtime_error(
"expression after REGEXP must be of a string type.");
801 char escape_char =
'\\';
802 if (escape_expr !=
nullptr) {
803 if (!escape_expr->get_type_info().is_string()) {
804 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
806 if (!escape_expr->get_type_info().is_string()) {
807 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
810 if (c !=
nullptr && c->get_constval().stringval->length() > 1) {
811 throw std::runtime_error(
"String after ESCAPE must have a single character.");
813 escape_char = (*c->get_constval().stringval)[0];
814 if (escape_char !=
'\\') {
815 throw std::runtime_error(
"Only supporting '\\' escape character.");
822 return LikeExpr::get(arg_expr, pattern_expr, escape_expr,
false, is_not);
825 std::shared_ptr<Analyzer::Expr>
result =
826 makeExpr<Analyzer::RegexpExpr>(arg_expr->decompress(), pattern_expr, escape_expr);
static bool translate_to_like_pattern(std::string &pattern_str, char escape_char)
static std::shared_ptr< Analyzer::Expr > get(std::shared_ptr< Analyzer::Expr > arg_expr, std::shared_ptr< Analyzer::Expr > like_expr, std::shared_ptr< Analyzer::Expr > escape_expr, const bool is_ilike, const bool is_not)
Datum get_constval() const