-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19784][SPARK-25403][SQL] Refresh the table even table stats is empty #22721
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
8a7f4af
37fed41
cc9b4df
983c5a8
6c8a73f
ebe8276
1e62a24
88d8d9e
c601b67
c91c154
a4a5313
2612167
c6a1a7d
817d2de
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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,6 +50,9 @@ object CommandUtils extends Logging { | |||||||||||||||||||||
| catalog.alterTableStats(table.identifier, Some(newStats)) | ||||||||||||||||||||||
| } else if (table.stats.nonEmpty) { | ||||||||||||||||||||||
| catalog.alterTableStats(table.identifier, None) | ||||||||||||||||||||||
| } else { | ||||||||||||||||||||||
| // In other cases, we still need to invalidate the table relation cache. | ||||||||||||||||||||||
|
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. Could you explain why we need to refresh table while updating stats, please. For instance, we can do the same work twice. See:
Member
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. Not all commands have refresh table logic, such as spark/sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala Lines 836 to 837 in b77d11d
|
||||||||||||||||||||||
| catalog.refreshTable(table.identifier) | ||||||||||||||||||||||
wangyum marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
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.
to confirm: does
catalog.alterTableStatsrefresh the relation cache?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.
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
Lines 409 to 422 in 1743d5b