Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/5564#discussion_r170271213
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/descriptors/Schema.scala
---
@@ -32,11 +32,36 @@ import scala.collection.mutable
*/
class Schema extends Descriptor {
+ private var deriveFields: Option[String] = None
+
// maps a field name to a list of properties that describe type, origin,
and the time attribute
private val tableSchema = mutable.LinkedHashMap[String,
mutable.LinkedHashMap[String, String]]()
private var lastField: Option[String] = None
+ /**
+ * Derives field names and types from a preceding connector or format.
Additional fields that
+ * are defined in this schema extend the derived fields. The derived
fields are
+ * added in an alphabetical order according to their field name.
+ */
+ def deriveFieldsAlphabetically(): Schema = {
--- End diff --
I think we should support inferring the format from the schema rather than
the schema from the format.
This would be more aligned with how it would work in a `CREATE TABLE`
statement and how Hive is doing it for example. We should still support to
define the format explicitly though.
---