flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wuchong <...@git.apache.org>
Subject [GitHub] flink pull request #4274: [FLINK-6975][table]Add CONCAT/CONCAT_WS supported ...
Date Wed, 12 Jul 2017 08:46:38 GMT
Github user wuchong commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4274#discussion_r126871598
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/stringExpressions.scala
---
    @@ -277,3 +278,47 @@ case class Overlay(
           position.toRexNode)
       }
     }
    +
    +/**
    +  * Returns the string that results from concatenating the arguments.
    +  * Returns NULL if any argument is NULL.
    +  */
    +case class Concat(strings: Seq[Expression]) extends Expression with InputTypeSpec {
    +
    +  override private[flink] def children: Seq[Expression] = strings
    +
    +  override private[flink] def resultType: TypeInformation[_] = BasicTypeInfo.STRING_TYPE_INFO
    +
    +  override private[flink] def expectedTypes: Seq[TypeInformation[_]] = STRING_TYPE_INFO
:: Nil
    +
    +  override def toString: String = s"Concat($strings)"
    +
    +
    +  override private[flink] def toRexNode(implicit relBuilder: RelBuilder): RexNode = {
    +    relBuilder.call(ScalarSqlFunctions.CONCAT, children.map(_.toRexNode))
    +  }
    +}
    +
    +/**
    +  * Returns the string that results from concatenating the arguments and separator.
    +  * Returns NULL If the separator is NULL.
    +  *
    +  * Note: this user-defined function does not skip empty strings. However, it does skip
any NULL
    +  * values after the separator argument.
    +  **/
    +case class ConcatWs(separator: Expression, strings: Seq[Expression])
    +  extends Expression with InputTypeSpec {
    +
    +  override private[flink] def children: Seq[Expression] = Seq(separator) ++ strings
    +
    +  override private[flink] def resultType: TypeInformation[_] = BasicTypeInfo.STRING_TYPE_INFO
    +
    +  override private[flink] def expectedTypes: Seq[TypeInformation[_]] = STRING_TYPE_INFO
:: Nil
    +
    +  override def toString: String = s"ConcatWs($separator, $strings)"
    +
    +
    --- End diff --
    
    remove empty line


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message