-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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-21180][SQL] Remove conf from stats functions since now we have conf in LogicalPlan #18391
Conversation
cc @rxin |
@@ -67,7 +67,7 @@ case class LocalRelation(output: Seq[Attribute], data: Seq[InternalRow] = Nil) | |||
} | |||
} | |||
|
|||
override def computeStats(conf: SQLConf): Statistics = | |||
override def computeStats: Statistics = |
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.
Can we remove import org.apache.spark.sql.internal.SQLConf
, too?
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 checked all modified files and removed unused imports. Thanks!
@@ -436,7 +436,7 @@ case class CatalogRelation( | |||
createTime = -1 | |||
)) | |||
|
|||
override def computeStats(conf: SQLConf): Statistics = { | |||
override def computeStats: Statistics = { |
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.
Can we remove import org.apache.spark.sql.internal.SQLConf, too?
@@ -90,8 +90,8 @@ abstract class LogicalPlan extends QueryPlan[LogicalPlan] with QueryPlanConstrai | |||
* first time. If the configuration changes, the cache can be invalidated by calling | |||
* [[invalidateStatsCache()]]. | |||
*/ | |||
final def stats(conf: SQLConf): Statistics = statsCache.getOrElse { | |||
statsCache = Some(computeStats(conf)) | |||
final def stats: Statistics = statsCache.getOrElse { |
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.
ditto
@@ -44,8 +44,8 @@ case class ResolvedHint(child: LogicalPlan, hints: HintInfo = HintInfo()) | |||
|
|||
override lazy val canonicalized: LogicalPlan = child.canonicalized | |||
|
|||
override def computeStats(conf: SQLConf): Statistics = { | |||
val stats = child.stats(conf) | |||
override def computeStats: Statistics = { |
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.
ditto
Test build #78459 has finished for PR 18391 at commit
|
thanks, SGTM |
Test build #78496 has finished for PR 18391 at commit
|
@@ -436,7 +436,7 @@ case class CatalogRelation( | |||
createTime = -1 | |||
)) | |||
|
|||
override def computeStats(conf: SQLConf): Statistics = { | |||
override def computeStats: Statistics = { |
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.
Yes, this file's import org.apache.spark.sql.internal.SQLConf
need to be removed
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.
Oh, I overlooked.
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.
Thanks! I checked the other interface file, there are several files with this name...
SQLConf.get.setConf(SQLConf.CBO_ENABLED, false) | ||
assert(plan.stats == expectedStatsCboOff) | ||
} finally { | ||
SQLConf.get.unsetConf(SQLConf.CBO_ENABLED) |
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.
first, get the original and then recover the original one in the finally block. You can check how we did it in SQLConfSuite
// From UnaryNode.computeStats, childSize * outputRowSize / childRowSize | ||
Statistics(sizeInBytes = 48 * (8 + 4 + 8) / (8 + 4))) | ||
} finally { | ||
SQLConf.get.unsetConf(SQLConf.CBO_ENABLED) |
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.
The same here.
} | ||
|
||
override def afterAll(): Unit = { | ||
SQLConf.get.unsetConf(SQLConf.CBO_ENABLED) |
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.
The same here.
Test build #78521 has finished for PR 18391 at commit
|
LGTM |
Thanks! Merging to master. |
… conf in LogicalPlan ## What changes were proposed in this pull request? After wiring `SQLConf` in logical plan ([PR 18299](apache#18299)), we can remove the need of passing `conf` into `def stats` and `def computeStats`. ## How was this patch tested? Covered by existing tests, plus some modified existing tests. Author: wangzhenhua <wangzhenhua@huawei.com> Author: Zhenhua Wang <wzh_zju@163.com> Closes apache#18391 from wzhfy/removeConf.
What changes were proposed in this pull request?
After wiring
SQLConf
in logical plan (PR 18299), we can remove the need of passingconf
intodef stats
anddef computeStats
.How was this patch tested?
Covered by existing tests, plus some modified existing tests.