Skip to content

[SPARK-54132][SQL][TESTS] Cover HashedRelation#close in HashedRelationSuite - #52830

Closed
zhztheplayer wants to merge 1 commit into
apache:masterfrom
zhztheplayer:wip-54132
Closed

[SPARK-54132][SQL][TESTS] Cover HashedRelation#close in HashedRelationSuite#52830
zhztheplayer wants to merge 1 commit into
apache:masterfrom
zhztheplayer:wip-54132

Conversation

@zhztheplayer

@zhztheplayerzhztheplayer commented Nov 1, 2025

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Add the following code in HashedRelationSuite, to cover the API HashedRelation#close in the test suite.

protectedoverridedefafterEach():Unit= {
super.afterEach()
assert(umm.executionMemoryUsed ===0)
}

Why are the changes needed?

Doing this will:

  1. Ensure HashedRelation#close is called in test code, to lower memory footprint and avoid memory leak when executing tests.
  2. Ensure implementations of HashedRelation#close free the allocated memory blocks correctly.

It's an individual effort to improve the test quality, but also a prerequisite task for #52817.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

It's a test PR.

Was this patch authored or co-authored using generative AI tooling?

No.

@zhztheplayer

Copy link
Copy Markdown
MemberAuthor

@HyukjinKwon@yaooqinn@wangyum@cloud-fan Could you please review? Thanks!

@cloud-fan

Copy link
Copy Markdown
Contributor

thanks, merging to master/4.1 (for test coverage)!

cloud-fan pushed a commit that referenced this pull request Nov 3, 2025
…nSuite
### What changes were proposed in this pull request?
Add the following code in `HashedRelationSuite`, to cover the API `HashedRelation#close` in the test suite.
```scala
protected override def afterEach(): Unit = {
super.afterEach()
assert(umm.executionMemoryUsed === 0)
}
```
### Why are the changes needed?
Doing this will:
1. Ensure `HashedRelation#close` is called in test code, to lower memory footprint and avoid memory leak when executing tests.
2. Ensure implementations of `HashedRelation#close` free the allocated memory blocks correctly.
It's an individual effort to improve the test quality, but also a prerequisite task for #52817.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
It's a test PR.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes#52830 from zhztheplayer/wip-54132.
Authored-by: Hongze Zhang <hongze.zzz123@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit a5e866f)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@zhztheplayer

Copy link
Copy Markdown
MemberAuthor

Thanks, @cloud-fan!

@yaooqinn

Copy link
Copy Markdown
Member

Late LGTM

huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
…nSuite
### What changes were proposed in this pull request?
Add the following code in `HashedRelationSuite`, to cover the API `HashedRelation#close` in the test suite.
```scala
protected override def afterEach(): Unit = {
super.afterEach()
assert(umm.executionMemoryUsed === 0)
}
```
### Why are the changes needed?
Doing this will:
1. Ensure `HashedRelation#close` is called in test code, to lower memory footprint and avoid memory leak when executing tests.
2. Ensure implementations of `HashedRelation#close` free the allocated memory blocks correctly.
It's an individual effort to improve the test quality, but also a prerequisite task for apache#52817.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
It's a test PR.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closesapache#52830 from zhztheplayer/wip-54132.
Authored-by: Hongze Zhang <hongze.zzz123@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zhztheplayer@cloud-fan@yaooqinn