Change 'bitwise or' to 'logical or' at StreamExecutionEnvironment.java:1597

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Change 'bitwise or' to 'logical or' at StreamExecutionEnvironment.java:1597

Pēteris Kļaviņš
I’d like to note a trivial code improvement that can be made to StreamExecutionEnvironment.java:1597. Neither is this worthy of its own Jira, nor of a pull request. It should probably be incorporated in some general code clean-up being done.

 

While the code strictly works as it stands, it is probably better to explicitly change the ‘bitwise or’ operator on this line to the ‘logical or’ operator. Here’s the Github location:

 

https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1597

 

and the complete diff of the proposed change:

 

klavi@UGUNS MINGW64 /i/Users/klavi/Src/flink (master)

$ git diff

diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java

index 355d2776a0..b6a52d456b 100644

--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java

+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java

@@ -1594,7 +1594,7 @@ public abstract class StreamExecutionEnvironment {

                ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

                if (env instanceof ContextEnvironment) {

                        return new StreamContextEnvironment((ContextEnvironment) env);

-               } else if (env instanceof OptimizerPlanEnvironment | env instanceof PreviewPlanEnvironment) {

+               } else if (env instanceof OptimizerPlanEnvironment || env instanceof PreviewPlanEnvironment) {

                        return new StreamPlanEnvironment(env);

                } else {

                        return createLocalEnvironment();

 

klavi@UGUNS MINGW64 /i/Users/klavi/Src/flink (master)

$

 

Reply | Threaded
Open this post in threaded view
|

Re: Change 'bitwise or' to 'logical or' at StreamExecutionEnvironment.java:1597

Fabian Hueske-2
Hi Peter,

thanks for suggesting this improvement!

You are right, this change does not justify an own JIRA, but I think it's
fine to open a PR with a "[hotfix]" commit.
We are frequently merging PRs that fix one or more JavaDoc typos. Also, a
PR increases the chances that this is actually fixed.

Thanks,
Fabian



2017-12-30 1:09 GMT+01:00 Peter Klavins <[hidden email]>:

> I’d like to note a trivial code improvement that can be made to
> StreamExecutionEnvironment.java:1597. Neither is this worthy of its own
> Jira, nor of a pull request. It should probably be incorporated in some
> general code clean-up being done.
>
>
>
> While the code strictly works as it stands, it is probably better to
> explicitly change the ‘bitwise or’ operator on this line to the ‘logical
> or’ operator. Here’s the Github location:
>
>
>
> https://github.com/apache/flink/blob/master/flink-
> streaming-java/src/main/java/org/apache/flink/streaming/api/environment/
> StreamExecutionEnvironment.java#L1597
>
>
>
> and the complete diff of the proposed change:
>
>
>
> klavi@UGUNS MINGW64 /i/Users/klavi/Src/flink (master)
>
> $ git diff
>
> diff --git a/flink-streaming-java/src/main/java/org/apache/flink/
> streaming/api/environment/StreamExecutionEnvironment.java
> b/flink-streaming-java/src/main/java/org/apache/flink/
> streaming/api/environment/StreamExecutionEnvironment.java
>
> index 355d2776a0..b6a52d456b 100644
>
> --- a/flink-streaming-java/src/main/java/org/apache/flink/
> streaming/api/environment/StreamExecutionEnvironment.java
>
> +++ b/flink-streaming-java/src/main/java/org/apache/flink/
> streaming/api/environment/StreamExecutionEnvironment.java
>
> @@ -1594,7 +1594,7 @@ public abstract class StreamExecutionEnvironment {
>
>                 ExecutionEnvironment env = ExecutionEnvironment.
> getExecutionEnvironment();
>
>                 if (env instanceof ContextEnvironment) {
>
>                         return new StreamContextEnvironment((ContextEnvironment)
> env);
>
> -               } else if (env instanceof OptimizerPlanEnvironment | env
> instanceof PreviewPlanEnvironment) {
>
> +               } else if (env instanceof OptimizerPlanEnvironment || env
> instanceof PreviewPlanEnvironment) {
>
>                         return new StreamPlanEnvironment(env);
>
>                 } else {
>
>                         return createLocalEnvironment();
>
>
>
> klavi@UGUNS MINGW64 /i/Users/klavi/Src/flink (master)
>
> $
>
>
>
>