Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/842#discussion_r89156823 --- Diff: core/sql/exp/exp_like.cpp --- @@ -477,6 +501,51 @@ ex_like_clause_base::processNulls(char *op_data[], CollHeap *heap, return ex_expr::EXPR_OK; } + +ex_expr::exp_return_type ExRegexpClauseChar::eval(char *op_data[], + CollHeap* exHeap, + ComDiagsArea** diagsArea) +{ + NABoolean matchFlag = true; + Lng32 len1 = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]); + Lng32 len2 = getOperand(2)->getLength(op_data[-MAX_OPERANDS+2]); + regex_t reg; + regmatch_t pm[1]; + const size_t nmatch = 1; + Lng32 cflags, z; + char * pattern; + char *srcStr= new (exHeap) char[len1+1]; + + cflags = REG_EXTENDED|REG_NEWLINE; + pattern = new (exHeap) char[len2+1]; + pattern[len2]=0; + srcStr[len1]=0; + + str_cpy_all(pattern, op_data[2], len2); + str_cpy_all(srcStr, op_data[1], len1); + + z = regcomp(®, pattern, cflags); + + if (z != 0){ + //ERROR + ExRaiseSqlError(exHeap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC); --- End diff -- I don't think this will give the user enough information to debug the error. I recommend at the very least including the value of z in the error message (for example, "regcomp call returned %d"), or even better, use the regerror() function to get a human readable error string back.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---