godfreyhe commented on a change in pull request #9362: [FLINK-13354] [docs] Add
documentation for how to use blink planner
URL: https://github.com/apache/flink/pull/9362#discussion_r314573781
##########
File path: docs/dev/table/common.md
##########
@@ -142,82 +147,153 @@ A `Table` is always bound to a specific
`TableEnvironment`. It is not possible t
A `TableEnvironment` is created by calling the static
`BatchTableEnvironment.create()` or `StreamTableEnvironment.create()` method
with a `StreamExecutionEnvironment` or an `ExecutionEnvironment` and an
optional `TableConfig`. The `TableConfig` can be used to configure the
`TableEnvironment` or to customize the query optimization and translation
process (see [Query Optimization](#query-optimization)).
-Make sure to choose the `BatchTableEnvironment`/`StreamTableEnvironment` that
matches your programming language.
+Make sure to choose the specific planner
`BatchTableEnvironment`/`StreamTableEnvironment` that matches your programming
language.
+
+If both planner jars are in the `/lib` directory, you should explicitly set
which planner is active in the current program.
<div class="codetabs" markdown="1">
<div data-lang="java" markdown="1">
{% highlight java %}
-// ***************
-// STREAMING QUERY
-// ***************
+
+// **********************
+// FLINK STREAMING QUERY
+// **********************
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.java.StreamTableEnvironment;
-StreamExecutionEnvironment sEnv =
StreamExecutionEnvironment.getExecutionEnvironment();
-// create a TableEnvironment for streaming queries
-StreamTableEnvironment sTableEnv = StreamTableEnvironment.create(sEnv);
+EnvironmentSettings fsSettings =
EnvironmentSettings.newInstance().useOldPlanner().inStreamingMode().build();
+StreamExecutionEnvironment fsEnv =
StreamExecutionEnvironment.getExecutionEnvironment();
+StreamTableEnvironment fsTableEnv = StreamTableEnvironment.create(fsEnv,
fsSettings);
+// or TableEnvironment fsTableEnv = TableEnvironment.create(fsSettings);
Review comment:
there are so many Environment, it's better to add prefix to distinguish each
other
----------------------------------------------------------------
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