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

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

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

    https://github.com/apache/incubator-trafodion/pull/703#discussion_r78925592
  
    --- Diff: core/sql/exp/exp_function.cpp ---
    @@ -7724,5 +7753,354 @@ Lng32 ExFunctionExtractColumns::unpack (void * 
base, void * reallocator)
        if (extractColList_.unpack(base)) return -1;
        return unpackClause(base, reallocator);
     }
    +
    +//helper function, convert a string into IPV4 , if valid, it can support 
leading and padding space
    +static Lng32 string2ipv4(char *srcData, Lng32 slen, unsigned int 
*inet_addr)
    +{
    +   Int16 i = 0, j = 0 , p=0, leadingspace=0;
    +   char buf[16]; 
    +   Int16 dot=0;
    +
    +   if(slen < MIN_IPV4_STRING_LEN ) 
    +     return 0;
    +
    +   unsigned char *ipv4_bytes= (unsigned char *)inet_addr;
    +
    +   if(srcData[0] == ' ')
    +   { 
    +     leadingspace++;
    +     for(i=1; i< slen; i++)
    +     {
    +       if(srcData[i] == ' ') leadingspace++;
    +       else break; 
    +     }
    +   }
    --- End diff --
    
    Much better, I appreciate your nicer code.


> function support: log2,IS_IPV4,IS_IPV6 etc
> ------------------------------------------
>
>                 Key: TRAFODION-2208
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2208
>             Project: Apache Trafodion
>          Issue Type: Sub-task
>            Reporter: liu ming
>            Assignee: liu ming
>
> add built-in function 
> IS_IPV4
> IS_IPV6
> LOG2
> Also try to enhance the least to accept multiple input arguments which is 
> required in both Oracle/MySQL.
> This will be an example about how to add new built-in functions, so start 
> with some very simple functions.
> One of the important goal is to guide the following developing works.



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

Reply via email to