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

ASF GitHub Bot commented on DRILL-5450:
---------------------------------------

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/821#discussion_r113791308
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
 ---
    @@ -169,7 +169,7 @@ public static void initCap(int start, int end, DrillBuf 
inBuf, DrillBuf outBuf)
             if (currentByte >= 0x30 && currentByte <= 0x39) { // 0-9
               // noop
             } else if (currentByte >= 0x41 && currentByte <= 0x5A) { // A-Z
    -          currentByte -= 0x20; // Lowercase this character
    +          currentByte += 0x20; // Lowercase this character
    --- End diff --
    
    currentByte = Character.toLowerCase( currentByte )
    
    The above handles all the Unicode complexity -- no need for us to 
reimplement it here.
    
    A concern might be performance. Try calling the above 10K times in a loop 
and this function 10K times. Is there a difference in cost?


> Fix initcap function to convert upper case characters correctly
> ---------------------------------------------------------------
>
>                 Key: DRILL-5450
>                 URL: https://issues.apache.org/jira/browse/DRILL-5450
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>    Affects Versions: 1.10.0
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>
> Initcap function converts incorrectly subsequent upper case characters after 
> first character.
> {noformat}
> 0: jdbc:drill:zk=local> select initcap('aaa') from (values(1));
> +---------+
> | EXPR$0  |
> +---------+
> | Aaa     |
> +---------+
> 1 row selected (0.275 seconds)
> 0: jdbc:drill:zk=local> select initcap('AAA') from (values(1));
> +---------+
> | EXPR$0  |
> +---------+
> | A!!     |
> +---------+
> 1 row selected (0.27 seconds)
> 0: jdbc:drill:zk=local> select initcap('aAa') from (values(1));
> +---------+
> | EXPR$0  |
> +---------+
> | A!a     |
> +---------+
> 1 row selected (0.229 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to