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

    https://github.com/apache/flink/pull/1747#discussion_r54578368
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/scala/table/expressionDsl.scala
 ---
    @@ -63,17 +63,77 @@ trait ImplicitExpressionOperations {
       def count = Count(expr)
       def avg = Avg(expr)
     
    +  def cast(toType: TypeInformation[_]) = Cast(expr, toType)
    +
    +  def as(name: Symbol) = Naming(expr, name.name)
    +
    +  // scalar functions
    +
    +  /**
    +    * Creates a substring of the given string between the given indices.
    +    *
    +    * @param beginIndex first character of the substring (starting at 1, 
inclusive)
    +    * @param endIndex last character of the substring (starting at 1, 
inclusive)
    +    * @return substring
    +    */
       def substring(beginIndex: Expression, endIndex: Expression) = {
    -    Substring(expr, beginIndex, Some(endIndex))
    +    Call(BuiltInFunctionNames.SUBSTRING, expr, beginIndex, endIndex)
       }
     
    +  /**
    +    * Creates a substring of the given string beginning at the given index 
to the end.
    +    *
    +    * @param beginIndex first character of the substring (starting at 1, 
inclusive)
    +    * @return substring
    +    */
       def substring(beginIndex: Expression) = {
    -    Substring(expr, beginIndex)
    +    Call(BuiltInFunctionNames.SUBSTRING, expr, beginIndex)
       }
     
    -  def cast(toType: TypeInformation[_]) = Cast(expr, toType)
    +  /**
    +    * Removes leading and trailing whitespaces from the given string.
    +    *
    +    * @return trimmed string
    +    */
    +  def trim() = {
    +    Call(
    +      BuiltInFunctionNames.TRIM,
    +      BuiltInFunctionConstants.TRIM_BOTH,
    +      BuiltInFunctionConstants.TRIM_DEFAULT_CHAR,
    +      expr)
    +  }
     
    -  def as(name: Symbol) = Naming(expr, name.name)
    +  /**
    +    * Removes leading and/or trailing characters from the given string.
    +    *
    +    * @param removeLeading if true, remove leading characters
    +    * @param removeTrailing if true, remove trailing characters
    +    * @param character String containing the character
    +    * @return trimmed string
    +    */
    +  def trim(removeLeading: Boolean, removeTrailing: Boolean, character: 
Expression) = {
    --- End diff --
    
    Yes, makes sense. I updated the PR.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to