twalthr commented on a change in pull request #11527:  [FLINK-16035] Updated 
Stream/BatchTableEnvironment.java to use Java's Expression DSL
URL: https://github.com/apache/flink/pull/11527#discussion_r401409452
 
 

 ##########
 File path: 
flink-table/flink-table-api-scala-bridge/src/main/scala/org/apache/flink/table/api/scala/BatchTableEnvironment.scala
 ##########
 @@ -164,11 +222,40 @@ trait BatchTableEnvironment extends TableEnvironment {
     * Creates a view from the given [[DataSet]] in a given path with specified 
field names.
     * Registered views can be referenced in SQL queries.
     *
+    * There are two modes for mapping original fields to the fields of the 
View:
+    *
+    * 1. Reference input fields by name:
+    * All fields in the schema definition are referenced by name
+    * (and possibly renamed using an alias (as). In this mode, fields can be 
reordered and
+    * projected out. This mode can be used for any input type, including POJOs.
+    *
+    * Example:
+    *
+    * {{{
+    *   val set: DataSet<Tuple2<String, Long>> = ...
+    *   tableEnv.createTemporaryView(
+    *      "cat.db.myTable",
+    *      set,
+    *      $"f1", // reorder and use the original field
+    *      $"f0" as "name" // reorder and give the original field a better name
+    *   )
+    * }}}
+    *
+    * 2. Reference input fields by position:
+    * In this mode, fields are simply renamed. This mode can only be
+    * used if the input type has a defined field order (tuple, case class, 
Row) and none of
+    * the `fields` references a field of the input type.
+    *
     * Example:
     *
     * {{{
-    *   val set: DataSet[(String, Long)] = ...
-    *   tableEnv.createTemporaryView("cat.db.myTable", set, 'a, 'b)
+    *   val set: DataSet<Tuple2<String, Long>> = ...
 
 Review comment:
   replace with Scala syntax

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

Reply via email to