You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/24 12:12:15 UTC

[GitHub] [flink] twalthr commented on a change in pull request #11533: [FLINK-16034][table-api, docs] Updated documentation with new Java Expression DSL

twalthr commented on a change in pull request #11533:
URL: https://github.com/apache/flink/pull/11533#discussion_r414516601



##########
File path: docs/dev/table/streaming/temporal_tables.zh.md
##########
@@ -176,7 +176,7 @@ ratesHistoryData.add(Tuple2.of("Euro", 119L));
 // Create and register an example table using above data set.
 // In the real setup, you should replace this with your own table.
 DataStream<Tuple2<String, Long>> ratesHistoryStream = env.fromCollection(ratesHistoryData);
-Table ratesHistory = tEnv.fromDataStream(ratesHistoryStream, "r_currency, r_rate, r_proctime.proctime");
+Table ratesHistory = tEnv.fromDataStream(ratesHistoryStream, $("r_currency"), $("r_rate"), $("r_proctime.proctime"));

Review comment:
       extract proctime from string

##########
File path: docs/dev/table/streaming/temporal_tables.md
##########
@@ -176,7 +176,7 @@ ratesHistoryData.add(Tuple2.of("Euro", 119L));
 // Create and register an example table using above data set.
 // In the real setup, you should replace this with your own table.
 DataStream<Tuple2<String, Long>> ratesHistoryStream = env.fromCollection(ratesHistoryData);
-Table ratesHistory = tEnv.fromDataStream(ratesHistoryStream, "r_currency, r_rate, r_proctime.proctime");
+Table ratesHistory = tEnv.fromDataStream(ratesHistoryStream, $("r_currency"), $("r_rate"), $("r_proctime.proctime"));

Review comment:
       extract proctime from string

##########
File path: docs/dev/table/streaming/time_attributes.md
##########
@@ -120,19 +120,21 @@ The processing time attribute is defined with the `.proctime` property during sc
 DataStream<Tuple2<String, String>> stream = ...;
 
 // declare an additional logical field as a processing time attribute
-Table table = tEnv.fromDataStream(stream, "user_name, data, user_action_time.proctime");
+Table table = tEnv.fromDataStream(stream, $("user_name"), $("data"), $("user_action_time").proctime()");
 
-WindowedTable windowedTable = table.window(Tumble.over("10.minutes").on("user_action_time").as("userActionWindow"));
+WindowedTable windowedTable = table.window(Tumble.over(interval(Duration.ofMinutes(10)))

Review comment:
       nit: new line before `Tumble` and proper 4 space indention?

##########
File path: docs/dev/table/tableApi.md
##########
@@ -669,9 +677,14 @@ Table result = orders.groupBy("a").select("a, b.sum as d");
 {% highlight java %}
 Table orders = tableEnv.from("Orders");
 Table result = orders
-    .window(Tumble.over("5.minutes").on("rowtime").as("w")) // define window
-    .groupBy("a, w") // group by key and window
-    .select("a, w.start, w.end, w.rowtime, b.sum as d"); // access window properties and aggregate
+    .window(Tumble.over(interval(Duration.ofMinutes(5))).on($("rowtime")).as("w")) // define window
+    .groupBy($("a"), $("w")) // group by key and window
+    .select(
+        $("a"), $("w").start(),

Review comment:
       new line after comma

##########
File path: docs/dev/table/tableApi.md
##########
@@ -807,13 +837,13 @@ val result: Table = orders
 val orders: Table = tableEnv.from("Orders")
 val result: Table = orders
     // define window
-    .window(Over  
-      partitionBy 'a
-      orderBy 'rowtime
+    .window(Over

Review comment:
       nit: newline before `Over`?

##########
File path: docs/dev/table/tableApi.md
##########
@@ -686,13 +699,17 @@ Table result = orders
 Table orders = tableEnv.from("Orders");
 Table result = orders
     // define window
-    .window(Over  
-      .partitionBy("a")
-      .orderBy("rowtime")
-      .preceding("UNBOUNDED_RANGE")
-      .following("CURRENT_RANGE")
+    .window(Over
+      .partitionBy($("a"))
+      .orderBy($("rowtime"))
+      .preceding(UNBOUNDED_RANGE)
+      .following(CURRENT_RANGE)
       .as("w"))
-    .select("a, b.avg over w, b.max over w, b.min over w"); // sliding aggregate
+    .select(
+        $("a"), $("b").avg().over($("w")),

Review comment:
       new line after comma

##########
File path: docs/dev/table/tableApi.zh.md
##########
@@ -72,7 +75,7 @@ result.print();
 
 The Scala Table API is enabled by importing `org.apache.flink.api.scala._` and `org.apache.flink.table.api.scala._`.
 
-The following example shows how a Scala Table API program is constructed. Table attributes are referenced using [Scala Symbols](http://scala-lang.org/files/archive/spec/2.12/01-lexical-syntax.html#symbol-literals), which start with an apostrophe character (`'`).
+The following example shows how a Scala Table API program is constructed. Table fields are referenced using Scala's String interpolation using a dolar character (`$`).

Review comment:
       `dollar`

##########
File path: docs/dev/table/tableApi.md
##########
@@ -1124,7 +1164,7 @@ tableEnv.registerFunction("rates", rates);
 // join with "Orders" based on the time attribute and key
 Table orders = tableEnv.from("Orders");
 Table result = orders
-    .joinLateral("rates(o_proctime)", "o_currency = r_currency")
+    .joinLateral(call("rates", $("o_proctime")), $("o_currency").isEqual("r_currency"))

Review comment:
       `$("r_currency")`

##########
File path: docs/dev/table/tableApi.md
##########
@@ -669,9 +677,14 @@ Table result = orders.groupBy("a").select("a, b.sum as d");
 {% highlight java %}
 Table orders = tableEnv.from("Orders");
 Table result = orders
-    .window(Tumble.over("5.minutes").on("rowtime").as("w")) // define window
-    .groupBy("a, w") // group by key and window
-    .select("a, w.start, w.end, w.rowtime, b.sum as d"); // access window properties and aggregate
+    .window(Tumble.over(interval(Duration.ofMinutes(5))).on($("rowtime")).as("w")) // define window
+    .groupBy($("a"), $("w")) // group by key and window
+    .select(
+        $("a"), $("w").start(),
+        $("w").end(),
+        $("w").rowtime(),
+        $("b").sum().as("d")
+    ); // access window properties and aggregate

Review comment:
       put comment on top of `.select()` call

##########
File path: docs/dev/table/tableApi.zh.md
##########
@@ -90,8 +93,8 @@ val tEnv = BatchTableEnvironment.create(env)
 val orders = tEnv.from("Orders") // schema (a, b, c, rowtime)
 
 val result = orders
-               .groupBy('a)
-               .select('a, 'b.count as 'cnt)
+               .groupBy($"a")
+               .select($"a", $"b".count as $"cnt")

Review comment:
       `as "cnt"`?




----------------------------------------------------------------
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:
users@infra.apache.org