-
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-19149] [SQL] Unify two sets of statistics in LogicalPlan #16529
Conversation
cc @rxin @cloud-fan |
LGTM |
Test build #71124 has finished for PR 16529 at commit
|
Test build #71129 has finished for PR 16529 at commit
|
retest this please |
Test build #71131 has finished for PR 16529 at commit
|
@@ -81,44 +81,36 @@ abstract class LogicalPlan extends QueryPlan[LogicalPlan] with Logging { | |||
} | |||
} | |||
|
|||
/** A cache for the estimated statistics, such that it will only be computed once. */ | |||
private val statsCache = new ThreadLocal[Option[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.
why does this need to be thread local?
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.
Is it possible a LogicalPlan is shared by different threads? May I ask what's your concern about multi-thread in #16401 (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.
ok i was thinking you could just use an AtomicReference
Merging in master. I will fix the thread local thing in a pr. |
Actually the multi-threaded issue probably doesn't matter. I will just change it to the original Option implementation. |
## What changes were proposed in this pull request? This patch simplifies slightly the logical plan statistics cache implementation, as discussed in apache#16529 ## How was this patch tested? N/A - this has no behavior change. Author: Reynold Xin <rxin@databricks.com> Closes apache#16544 from rxin/SPARK-19149.
## What changes were proposed in this pull request? Currently we have two sets of statistics in LogicalPlan: a simple stats and a stats estimated by cbo, but the computing logic and naming are quite confusing, we need to unify these two sets of stats. ## How was this patch tested? Just modify existing tests. Author: wangzhenhua <wangzhenhua@huawei.com> Author: Zhenhua Wang <wzh_zju@163.com> Closes apache#16529 from wzhfy/unifyStats.
## What changes were proposed in this pull request? This patch simplifies slightly the logical plan statistics cache implementation, as discussed in apache#16529 ## How was this patch tested? N/A - this has no behavior change. Author: Reynold Xin <rxin@databricks.com> Closes apache#16544 from rxin/SPARK-19149.
## What changes were proposed in this pull request? Currently we have two sets of statistics in LogicalPlan: a simple stats and a stats estimated by cbo, but the computing logic and naming are quite confusing, we need to unify these two sets of stats. ## How was this patch tested? Just modify existing tests. Author: wangzhenhua <wangzhenhua@huawei.com> Author: Zhenhua Wang <wzh_zju@163.com> Closes apache#16529 from wzhfy/unifyStats.
## What changes were proposed in this pull request? This patch simplifies slightly the logical plan statistics cache implementation, as discussed in apache#16529 ## How was this patch tested? N/A - this has no behavior change. Author: Reynold Xin <rxin@databricks.com> Closes apache#16544 from rxin/SPARK-19149.
What changes were proposed in this pull request?
Currently we have two sets of statistics in LogicalPlan: a simple stats and a stats estimated by cbo, but the computing logic and naming are quite confusing, we need to unify these two sets of stats.
How was this patch tested?
Just modify existing tests.