flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #3829: [FLINK-6442] [table] Extend TableAPI Support Sink ...
Date Mon, 18 Sep 2017 20:52:13 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3829#discussion_r139522124
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/BatchTableEnvironment.scala
---
    @@ -106,6 +106,56 @@ abstract class BatchTableEnvironment(
       }
     
       /**
    +    * Registers an external [[TableSink]] with given field names and types in this
    +    * [[TableEnvironment]]'s catalog. Registered sink tables can be referenced in SQL
DML clause.
    +    *
    +    * Examples:
    +    *
    +    * - predefine a table sink and its field names and types
    +    * {{{
    +    *   val fieldNames: Array[String]  = Array("a", "b", "c")
    +    *   val fieldTypes: Array[TypeInformation[_]]  = Array(Types.STRING, Types.INT, Types.LONG)
    +    *   val tableSink: TableSink = new YourTableSinkImpl(...)
    +    * }}}
    +    *
    +    * -  register an alias for this table sink to catalog
    +    * {{{
    +    *   tableEnv.registerTableSink("example_sink_table", fieldNames, fieldsTypes, tableSink)
    +    * }}}
    +    *
    +    * -  use the registered sink in SQL directly
    +    * {{{
    +    *   tableEnv.sqlInsert("INSERT INTO example_sink_table SELECT a, b, c FROM sourceTable")
    +    * }}}
    +    *
    +    * @param name      The name under which the [[TableSink]] is registered.
    +    * @param tableSink The [[TableSink]] to register.
    --- End diff --
    
    add `fieldNames` and `fieldTypes` parameters


---

Mime
View raw message