Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-35552][SQL] Make query stage materialized more readable #32689

Closed
wants to merge 3 commits into from

Conversation

ulysses-you
Copy link
Contributor

What changes were proposed in this pull request?

Add a new method isMaterialized in QueryStageExec.

Why are the changes needed?

Currently, we use resultOption().get.isDefined to check if a query stage has materialized. The code is not readable at a glance. It's better to use a new method like isMaterialized to define it.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass CI.

@github-actions github-actions bot added the SQL label May 28, 2021
@ulysses-you
Copy link
Contributor Author

cc @maropu @cloud-fan

@SparkQA
Copy link

SparkQA commented May 28, 2021

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

@HyukjinKwon
Copy link
Member

HyukjinKwon commented May 28, 2021

@ulysses-you, the docker test failure should be now fixed in the latest master branch.

@SparkQA
Copy link

SparkQA commented May 28, 2021

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

@ulysses-you
Copy link
Contributor Author

thank you @HyukjinKwon , I will retriggered the GA.

val dataSize = runtimeStats.sizeInBytes.max(0)
val numOutputRows = runtimeStats.rowCount.map(_.max(0))
Statistics(dataSize, numOutputRows, isRuntime = true)
def computeStats(): Option[Statistics] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

def computeStats(): Option[Statistics] = if (isMaterialized) {
   ...
} else {
  ...
}

}

@transient
@volatile
protected var _resultOption = new AtomicReference[Option[Any]](None)

private[adaptive] def resultOption: AtomicReference[Option[Any]] = _resultOption
private[adaptive] def isMaterialized: Boolean = resultOption.get().isDefined
Copy link
Contributor

Choose a reason for hiding this comment

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

materialize is a public method, I think it makes more sense to make isMaterialized public as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm ok with it, but just wonder which code place may use isMaterialized without adaptive ?

@SparkQA
Copy link

SparkQA commented May 28, 2021

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

@SparkQA
Copy link

SparkQA commented May 28, 2021

Kubernetes integration test unable to build dist.

exiting with code: 1
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43573/

@SparkQA
Copy link

SparkQA commented May 28, 2021

Test build #139043 has finished for PR 32689 at commit 06a5cd7.

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

@SparkQA
Copy link

SparkQA commented May 28, 2021

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

@SparkQA
Copy link

SparkQA commented May 28, 2021

Test build #139052 has finished for PR 32689 at commit 6b18894.

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

@gengliangwang
Copy link
Member

Thanks, merging to master

@ulysses-you
Copy link
Contributor Author

thanks for merging !

@ulysses-you ulysses-you deleted the SPARK-35552 branch May 28, 2021 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants