801 if (!arg_expr->get_type_info().is_string()) {
802 throw std::runtime_error(
"expression before REGEXP must be of a string type.");
804 if (!pattern_expr->get_type_info().is_string()) {
805 throw std::runtime_error(
"expression after REGEXP must be of a string type.");
807 char escape_char =
'\\';
808 if (escape_expr !=
nullptr) {
809 if (!escape_expr->get_type_info().is_string()) {
810 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
812 if (!escape_expr->get_type_info().is_string()) {
813 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
816 if (c !=
nullptr && c->get_constval().stringval->length() > 1) {
817 throw std::runtime_error(
"String after ESCAPE must have a single character.");
819 escape_char = (*c->get_constval().stringval)[0];
820 if (escape_char !=
'\\') {
821 throw std::runtime_error(
"Only supporting '\\' escape character.");
828 return LikeExpr::get(arg_expr, pattern_expr, escape_expr,
false, is_not);
831 std::shared_ptr<Analyzer::Expr>
result =
832 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