-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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-19765][SPARK-18549][SQL] UNCACHE TABLE should un-cache all cached plans that refer to this table #17097
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,9 @@ case class InsertIntoDataSourceCommand( | |
val df = sparkSession.internalCreateDataFrame(data.queryExecution.toRdd, logicalRelation.schema) | ||
relation.insert(df, overwrite) | ||
|
||
// Invalidate the cache. | ||
sparkSession.sharedState.cacheManager.invalidateCache(logicalRelation) | ||
// Re-cache all cached plans(including this relation itself, if it's cached) that refer to this | ||
// data source relation. | ||
sparkSession.sharedState.cacheManager.recacheByPlan(sparkSession, logicalRelation) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the current design, users need to re-cache the queries by themselves. After this change, insertion could be super slow. Each insert could trigger the recache of many involved cached data, each of which could be very complex and expensive. That is a trade-off. Although we keep the data correctness/consistence, we could sacrifice the performance/user experience. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't change the behavior, just rename I'll open a new discussion about whether we should do recache after insertion or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uh... My fault... |
||
|
||
Seq.empty[Row] | ||
} | ||
|
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.
This is a behavior change.
Will
uncache
be a very expensive operation if we recache all the related cached plans?