This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new a23d8e3 [FLINK-23490][examples][table] Updated print output in
StreamWindowSQLExample
a23d8e3 is described below
commit a23d8e393a9179f90ce879d8ba21ee36a946360e
Author: mans2singh <[email protected]>
AuthorDate: Wed Jul 28 01:42:41 2021 -0400
[FLINK-23490][examples][table] Updated print output in
StreamWindowSQLExample
This closes #16587
---
.../examples/java/basics/StreamWindowSQLExample.java | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git
a/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/StreamWindowSQLExample.java
b/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/StreamWindowSQLExample.java
index a96cbfc..eb3f33d 100644
---
a/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/StreamWindowSQLExample.java
+++
b/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/basics/StreamWindowSQLExample.java
@@ -19,9 +19,7 @@
package org.apache.flink.table.examples.java.basics;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
-import org.apache.flink.types.Row;
import org.apache.flink.util.FileUtils;
import java.io.File;
@@ -79,16 +77,16 @@ public class StreamWindowSQLExample {
+ " COUNT(DISTINCT product) unique_products\n"
+ "FROM orders\n"
+ "GROUP BY TUMBLE(ts, INTERVAL '5' SECOND)";
- Table result = tEnv.sqlQuery(query);
- tEnv.toAppendStream(result, Row.class).print();
-
- // after the table program is converted to DataStream program,
- // we must use `env.execute()` to submit the job.
- env.execute("Streaming Window SQL Job");
+ tEnv.executeSql(query).print();
// should output:
- // 2019-12-12 00:00:00.000,3,10,3
- // 2019-12-12 00:00:05.000,3,6,2
+ //
+----+--------------------------------+--------------+--------------+-----------------+
+ // | op | window_start | order_num | total_amount
| unique_products |
+ //
+----+--------------------------------+--------------+--------------+-----------------+
+ // | +I | 2019-12-12 00:00:00.000 | 3 | 10
| 3 |
+ // | +I | 2019-12-12 00:00:05.000 | 3 | 6
| 2 |
+ //
+----+--------------------------------+--------------+--------------+-----------------+
+
}
/** Creates a temporary file with the contents and returns the absolute
path. */