aokolnychyi commented on code in PR #52599:
URL: https://github.com/apache/spark/pull/52599#discussion_r2449630779
##########
sql/core/src/main/scala/org/apache/spark/sql/classic/Catalog.scala:
##########
@@ -810,20 +811,13 @@ class Catalog(sparkSession: SparkSession) extends
catalog.Catalog {
* @since 2.0.0
*/
override def uncacheTable(tableName: String): Unit = {
- // We first try to parse `tableName` to see if it is 2 part name. If so,
then in HMS we check
- // if it is a temp view and uncache the temp view from HMS, otherwise we
uncache it from the
- // cache manager.
- // if `tableName` is not 2 part name, then we directly uncache it from the
cache manager.
- try {
- val tableIdent =
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
-
sessionCatalog.getLocalOrGlobalTempView(tableIdent).map(uncacheView).getOrElse {
-
sparkSession.sharedState.cacheManager.uncacheQuery(sparkSession.table(tableName),
- cascade = true)
- }
- } catch {
- case e: org.apache.spark.sql.catalyst.parser.ParseException =>
-
sparkSession.sharedState.cacheManager.uncacheQuery(sparkSession.table(tableName),
- cascade = true)
+ // parse the table name and check if it's a temp view (must have 1-2 name
parts)
+ // temp views are uncached using uncacheView which respects view text
semantics (SPARK-33142)
+ // use CommandUtils for all tables (including with 3+ part names)
+ val nameParts =
sparkSession.sessionState.sqlParser.parseMultipartIdentifier(tableName)
+
sessionCatalog.getLocalOrGlobalTempView(nameParts).map(uncacheView).getOrElse {
+ sparkSession.table(tableName) // throws an error if the table doesn't
exist
Review Comment:
This line is here to preserve the original behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]