-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19765][SPARK-18549][SQL] UNCACHE TABLE should un-cache all cached plans that refer to this table #17097
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
Changes from all commits
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) | ||
|
Member
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.
Contributor
Author
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.
Member
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] | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
DropTableCommand,TruncateTableCommand,AlterTableRenameCommand,UncacheTableCommand,RefreshTableandInsertIntoHiveTablewill be affected by the behavior changes of this function, right?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, but I don't want to test all of them, just pick a typical one and prove the
uncacheQueryworks correctly.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.
there is another scenario that after alter datasource table location, we can't uncache the table,
JIRA