Skip to content

[SPARK-33346][CORE][SQL][MLLIB][DSTREAM][K8S] Change the never changed 'var' to 'val'#31142

Closed
LuciferYang wants to merge 10 commits intoapache:masterfrom
LuciferYang:SPARK-33346
Closed

[SPARK-33346][CORE][SQL][MLLIB][DSTREAM][K8S] Change the never changed 'var' to 'val'#31142
LuciferYang wants to merge 10 commits intoapache:masterfrom
LuciferYang:SPARK-33346

Conversation

@LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Jan 12, 2021

What changes were proposed in this pull request?

Some local variables are declared as var, but they are never reassigned and should be declared as val, so this pr turn these from var to val except for mockito related cases.

Why are the changes needed?

Use val instead of var when possible.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Pass the Jenkins or GitHub Action

@LuciferYang LuciferYang changed the title [SPARK-33346][CORE][SQL][MLLIB] Change the never changed 'var' to 'val' [SPARK-33346][CORE][SQL][MLLIB] Use 'val' instead of 'var' when possible. Jan 12, 2021
@LuciferYang LuciferYang changed the title [SPARK-33346][CORE][SQL][MLLIB] Use 'val' instead of 'var' when possible. [WIP][SPARK-33346][CORE][SQL][MLLIB] Change the never changed 'var' to 'val' Jan 12, 2021
@LuciferYang LuciferYang marked this pull request as draft January 12, 2021 05:52
@SparkQA
Copy link

SparkQA commented Jan 12, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38548/

@SparkQA
Copy link

SparkQA commented Jan 12, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38548/

@LuciferYang LuciferYang changed the title [WIP][SPARK-33346][CORE][SQL][MLLIB] Change the never changed 'var' to 'val' [SPARK-33346][CORE][SQL][MLLIB] Change the never changed 'var' to 'val' Jan 12, 2021
@LuciferYang LuciferYang marked this pull request as ready for review January 12, 2021 07:48
@SparkQA
Copy link

SparkQA commented Jan 12, 2021

Test build #133961 has finished for PR 31142 at commit 3929b10.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

@jaceklaskowski jaceklaskowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (non-binding)

@SparkQA
Copy link

SparkQA commented Jan 12, 2021

Test build #133955 has finished for PR 31142 at commit 924358a.

  • This patch fails from timeout after a configured wait of 500m.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. Are there more?

@LuciferYang
Copy link
Contributor Author

@srowen Let me check test dir today

@LuciferYang
Copy link
Contributor Author

@srowen Address 67e16b9 add test dir related files

@LuciferYang LuciferYang changed the title [SPARK-33346][CORE][SQL][MLLIB] Change the never changed 'var' to 'val' [SPARK-33346][CORE][SQL][MLLIB][STREAMING][K8S] Change the never changed 'var' to 'val' Jan 13, 2021
@LuciferYang LuciferYang changed the title [SPARK-33346][CORE][SQL][MLLIB][STREAMING][K8S] Change the never changed 'var' to 'val' [SPARK-33346][CORE][SQL][MLLIB][DSTREAM][K8S] Change the never changed 'var' to 'val' Jan 13, 2021
@SparkQA
Copy link

SparkQA commented Jan 13, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38603/

@SparkQA
Copy link

SparkQA commented Jan 13, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38603/

@SparkQA
Copy link

SparkQA commented Jan 13, 2021

Test build #134016 has finished for PR 31142 at commit 4c48d68.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

import org.apache.spark.deploy.DeployTestUtils._

@Mock(answer = RETURNS_SMART_NULLS) private var shuffleService: ExternalShuffleService = _
@Mock(answer = RETURNS_SMART_NULLS) private val shuffleService: ExternalShuffleService = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I was going to wonder if we have to leave mocked members as 'var' because the framework will change them. But it looks like tests pass.

Copy link
Contributor Author

@LuciferYang LuciferYang Jan 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/mockito/mockito/blob/019830665f97c8ba6159148e3b10086cfb894900/src/main/java/org/mockito/internal/util/reflection/FieldSetter.java#L13-L18

image

mockito use reflection api to change them, so they can be val, although var seems easier to understand.

So for ease of understanding, we can also not change the case related to @Mock

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, maybe revert those just to be conservative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done ~

@SparkQA
Copy link

SparkQA commented Jan 14, 2021

Test build #134058 has started for PR 31142 at commit 06dbd94.

@SparkQA
Copy link

SparkQA commented Jan 14, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38644/

@SparkQA
Copy link

SparkQA commented Jan 14, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38644/

@SparkQA
Copy link

SparkQA commented Jan 15, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38654/

@SparkQA
Copy link

SparkQA commented Jan 15, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38654/

@srowen
Copy link
Member

srowen commented Jan 15, 2021

Jenkins retest this please

@SparkQA
Copy link

SparkQA commented Jan 15, 2021

Test build #134068 has finished for PR 31142 at commit c599a05.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Jan 15, 2021

Test build #134077 has finished for PR 31142 at commit c599a05.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 15, 2021

Test build #134088 has finished for PR 31142 at commit c599a05.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Jan 15, 2021

Merged to master

@srowen srowen closed this in 9e33d49 Jan 15, 2021
@LuciferYang
Copy link
Contributor Author

thx~ @srowen and @HyukjinKwon

@LuciferYang LuciferYang deleted the SPARK-33346 branch June 6, 2022 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants