Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/3829#discussion_r136125340
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala
---
@@ -1002,4 +1124,28 @@ object TableEnvironment {
case d: DefinedFieldNames => d.getFieldIndices
case _ => TableEnvironment.getFieldIndices(tableSource.getReturnType)
}
+
+ /**
+ * Returns field names for a given [[TableSink]].
+ *
+ * @param tableSink The TableSink to extract field names from.
+ * @tparam A The type of the TableSink.
+ * @return An array holding the field names.
+ */
+ def getFieldNames[A](tableSink: TableSink[A]): Array[String] = tableSink
match {
+ case d: DefinedFieldNames => d.getFieldNames
+ case _ => TableEnvironment.getFieldNames(tableSink.getOutputType)
+ }
+
+ /**
+ * Returns field indices for a given [[TableSink]].
+ *
+ * @param tableSink The TableSink to extract field indices from.
+ * @tparam A The type of the TableSink.
+ * @return An array holding the field indices.
+ */
+ def getFieldIndices[A](tableSink: TableSink[A]): Array[Int] = tableSink
match {
--- End diff --
We don't need this method. A `TableSink` is configured with a schema. It
does not need indicies and should not implement `DefinedFieldNames`.
---
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.
---