flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-6892) Add L/RPAD supported in SQL
Date Wed, 19 Jul 2017 12:51:00 GMT

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

ASF GitHub Bot commented on FLINK-6892:
---------------------------------------

Github user sunjincheng121 commented on the issue:

    https://github.com/apache/flink/pull/4127
  
    Hi, @twalthr Thanks for your reviewing. 
    For performance reasons I have not using `String.format()`. I have a simple test using
`String.format()` and PR approach. run `100000` times. The result as follows:
    `str.concat(String.format("%" + (length - str.length()) + "s", "").replace(" ", car));`
: 1345ms
    `The PR lpad` : 145ms. So I think we should not using `String.format()`. Please tell me
if there are any mistake.
    
    Thanks, Jincheng



> Add L/RPAD supported in SQL
> ---------------------------
>
>                 Key: FLINK-6892
>                 URL: https://issues.apache.org/jira/browse/FLINK-6892
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>    Affects Versions: 1.4.0
>            Reporter: sunjincheng
>            Assignee: sunjincheng
>
> L/RPAD(str,len,padstr) Returns the string str, left/right-padded with the string padstr
to a length of len characters. If str is longer than len, the return value is shortened to
len characters.
> * Syntax:
> LPAD(str,len,padstr) 
> * Arguments
> **str: -
> **len: -
> **padstr: -
> * Return Types
>   String
> * Example:
>   LPAD('hi',4,'??') -> '??hi'
>   LPAD('hi',1,'??') -> 'h'
>   RPAD('hi',4,'??') -> 'hi??'
>   RPAD('hi',1,'??') -> 'h'
> * See more:
> ** [MySQL| https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_lpad]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message