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
---