-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15367] [SQL] Add refreshTable back #13156
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 10 commits
b1cd1c6
bdd7c61
e3564d5
c3f3f0b
9e6c4b7
5f342f7
4ac3b76
7142ef5
8a52ac6
2b773b8
20d5055
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 |
|---|---|---|
|
|
@@ -622,7 +622,7 @@ class MetastoreDataSourcesSuite extends QueryTest with SQLTestUtils with TestHiv | |
| .mode(SaveMode.Append) | ||
| .saveAsTable("arrayInParquet") | ||
|
|
||
| sessionState.refreshTable("arrayInParquet") | ||
| sparkSession.catalog.refreshTable("arrayInParquet") | ||
|
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. As we don't call
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. Actually, I also want to remove
Contributor
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. Actually, invalidateTable and refreshTable do have different meanings. The current implementation of
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. Got it. Thanks! |
||
|
|
||
| checkAnswer( | ||
| sql("SELECT a FROM arrayInParquet"), | ||
|
|
@@ -681,7 +681,7 @@ class MetastoreDataSourcesSuite extends QueryTest with SQLTestUtils with TestHiv | |
| .mode(SaveMode.Append) | ||
| .saveAsTable("mapInParquet") | ||
|
|
||
| sessionState.refreshTable("mapInParquet") | ||
| sparkSession.catalog.refreshTable("mapInParquet") | ||
|
|
||
| checkAnswer( | ||
| sql("SELECT a FROM mapInParquet"), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,4 +58,16 @@ class HiveContext private[hive]( | |
| sparkSession.sharedState.asInstanceOf[HiveSharedState] | ||
| } | ||
|
|
||
| /** | ||
| * Invalidate and refresh all the cached the metadata of the given table. For performance reasons, | ||
| * Spark SQL or the external data source library it uses might cache certain metadata about a | ||
| * table, such as the location of blocks. When those change outside of Spark SQL, users should | ||
| * call this function to invalidate the cache. | ||
| * | ||
| * @since 1.3.0 | ||
| */ | ||
| def refreshTable(tableName: String): Unit = { | ||
|
Contributor
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. if
Contributor
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. This class is for the compatibility purpose. Let's leave it as is.
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. +1 |
||
| sparkSession.catalog.refreshTable(tableName) | ||
| } | ||
|
|
||
| } | ||
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.
SharedStatecan refresh the cached table data. InSessionState, we only can refresh the metadata. Thus, this APIrefreshTableonly refresh the metadataThere 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.
Let me know if we need to remove the API
refreshTableinSessionState. So far, it is not being used by any test case. Thanks!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.
@gatorsmile this is super confusing, the fact that
spark.catalog.refreshTableandspark.sessionState.refreshTabledo different things. Should we just rename this toinvalidateTablealong withHiveMetastoreCatalog.refreshTable?