[ 
https://issues.apache.org/jira/browse/TRAFODION-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15687226#comment-15687226
 ] 

ASF GitHub Bot commented on TRAFODION-2353:
-------------------------------------------

Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/842#discussion_r89157494
  
    --- 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(&reg, pattern, cflags);
    --- End diff --
    
    This is good for now. Later we can think about ways to move the regcomp 
call to fixup time if the pattern is constant, which will save some execution 
time path length (but introduces complications in memory management).


> support of the regexp operator
> ------------------------------
>
>                 Key: TRAFODION-2353
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2353
>             Project: Apache Trafodion
>          Issue Type: New Feature
>            Reporter: liu ming
>            Assignee: liu ming
>
> It is desired to have REGEXP.
> Some initial researching already done in: 
> https://cwiki.apache.org/confluence/display/TRAFODION/Example+Enhancement%3A+Add+a+New+Built-in+Function
> This JIRA is to add REGEXP operator, not including functions may required 
> future, if required, related JIRA will be created.
> The good advice in the wiki is to do new features incrementally. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to