-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-25534][SQL] Make SQLHelper trait
#22548
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
Conversation
|
Could you review this PR, @cloud-fan , @gatorsmile , and @wangyum ? |
| * mandating a FunSuite. | ||
| */ | ||
| trait PlanTestBase extends PredicateHelper { self: Suite => | ||
| trait PlanTestBase extends PredicateHelper with SupportWithSQLConf { self: Suite => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put SupportWithSQLConf.scala in the same package with PlanTest. If needed, we can move this to another better place.
|
We have duplicated |
|
+1, Sure, @cloud-fan ! |
|
It turns out that def withTempTable(tableNames: String*)(f: => Unit): Unit = {
try f finally tableNames.foreach(spark.catalog.dropTempView)
}Since it requires function signature changes, shall we postpone |
|
sure |
SupportWithSQLConf traitSQLHelper trait
HyukjinKwon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if the tests pass
|
Test build #96579 has finished for PR 22548 at commit
|
|
Thank you, @HyukjinKwon and @cloud-fan ! I'll merge this to the master. It's still running. |
|
Test build #96586 has finished for PR 22548 at commit
|
|
It passed. Merged to |
## What changes were proposed in this pull request?
Currently, Spark has 7 `withTempPath` and 6 `withSQLConf` functions. This PR aims to remove duplicated and inconsistent code and reduce them to the following meaningful implementations.
**withTempPath**
- `SQLHelper.withTempPath`: The one which was used in `SQLTestUtils`.
**withSQLConf**
- `SQLHelper.withSQLConf`: The one which was used in `PlanTest`.
- `ExecutorSideSQLConfSuite.withSQLConf`: The one which doesn't throw `AnalysisException` on StaticConf changes.
- `SQLTestUtils.withSQLConf`: The one which overrides intentionally to change the active session.
```scala
protected override def withSQLConf(pairs: (String, String)*)(f: => Unit): Unit = {
SparkSession.setActiveSession(spark)
super.withSQLConf(pairs: _*)(f)
}
```
## How was this patch tested?
Pass the Jenkins with the existing tests.
Closes apache#22548 from dongjoon-hyun/SPARK-25534.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
Currently, Spark has 7
withTempPathand 6withSQLConffunctions. This PR aims to remove duplicated and inconsistent code and reduce them to the following meaningful implementations.withTempPath
SQLHelper.withTempPath: The one which was used inSQLTestUtils.withSQLConf
SQLHelper.withSQLConf: The one which was used inPlanTest.ExecutorSideSQLConfSuite.withSQLConf: The one which doesn't throwAnalysisExceptionon StaticConf changes.SQLTestUtils.withSQLConf: The one which overrides intentionally to change the active session.How was this patch tested?
Pass the Jenkins with the existing tests.