Github user fhueske commented on the pull request:
https://github.com/apache/flink/pull/1961#issuecomment-216588444
Thanks for the feedback @yjshen.
The motivation of the `TableSink` interface is to support very different
storage systems (JDBC, Cassandra, Kafka, HBase, ...) and formats (CSV, Parquet,
Avro, etc.). The idea is to reuse existing OutputFormats (DataSet) and
SinkFunctions (DataStream) as much as possible. The configuration of the
`TableSink` with field names and types happens internally and is not
user-facing.
While the goal is to support many different systems, we do not want to blow
up the the dependencies of the flink-table module. With the current design we
can add TableSinks to the respective modules in `flink-batch-connectors` and
`flink-streaming-connectors` and don't have to add all external dependencies to
the Table API. Also we want to give users the option to define their own table
sinks.
I am not sure about configuring the output type and parameters with untyped
Strings. IMO, this makes it hard to identify and look up relevant parameters
and options.
But maybe we can add a registration of TableSinks to the TableEnvironment
and do something like:
```
tEnv.registerSinkType("csv", classOf[CsvTableSink])
val t: Table = ...
t.toSink("csv").option("path", "/foo").option("fileDelim", "|")
```
We would need to find a way to pass the options to the TableSink
constructor, maybe via reflection...
---
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.
---