wuchong commented on a change in pull request #11047: [FLINK-15912][table] Add
Context to TableSourceFactory and TableSinkFactory
URL: https://github.com/apache/flink/pull/11047#discussion_r377451955
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableSinkFactory.java
##########
@@ -53,4 +55,39 @@
return createTableSink(table.toProperties());
}
+ /**
+ * Creates and configures a {@link TableSink} based on the given
+ {@link Context}.
+ *
+ * @param context context of this table sink.
+ * @return the configured table sink.
+ */
+ default TableSink<T> createTableSink(Context context) {
+ return createTableSink(
+ context.getObjectIdentifier().toObjectPath(),
+ context.getTable());
+ }
+
+ /**
+ * Context of table sink creation. Contains table information and
+ environment information.
+ */
+ interface Context {
+
+ /**
+ * @return full identifier of the given {@link CatalogTable}.
+ */
+ ObjectIdentifier getObjectIdentifier();
+
+ /**
+ * @return table {@link CatalogTable} instance.
+ */
+ CatalogTable getTable();
+
+ /**
+ * @return readable config of this table environment.
Review comment:
Add a description that the configuration gives the factory instance the
ability to access `TableConfig#getConfiguration()` which holds the current
TableEnvironment session configurations.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services