diff options
author | gatorsmile <gatorsmile@gmail.com> | 2016-08-08 22:34:28 +0800 |
---|---|---|
committer | Wenchen Fan <wenchen@databricks.com> | 2016-08-08 22:34:28 +0800 |
commit | 5959df217df53196607b7fa744cdc2b36311360e (patch) | |
tree | 8648a631cec8f9197e6e39bb77df0bbe6f3b09e9 /sql/catalyst/src/main/scala | |
parent | ab126909ce381842dbb057d480a1f9bee1b4f38e (diff) | |
download | spark-5959df217df53196607b7fa744cdc2b36311360e.tar.gz spark-5959df217df53196607b7fa744cdc2b36311360e.tar.bz2 spark-5959df217df53196607b7fa744cdc2b36311360e.zip |
[SPARK-16936][SQL] Case Sensitivity Support for Refresh Temp Table
### What changes were proposed in this pull request?
Currently, the `refreshTable` API is always case sensitive.
When users use the view name without the exact case match, the API silently ignores the call. Users might expect the command has been successfully completed. However, when users run the subsequent SQL commands, they might still get the exception, like
```
Job aborted due to stage failure:
Task 1 in stage 4.0 failed 1 times, most recent failure: Lost task 1.0 in stage 4.0 (TID 7, localhost):
java.io.FileNotFoundException:
File file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-bd4b9ea6-9aec-49c5-8f05-01cff426211e/part-r-00000-0c84b915-c032-4f2e-abf5-1d48fdbddf38.snappy.parquet does not exist
```
This PR is to fix the issue.
### How was this patch tested?
Added a test case.
Author: gatorsmile <gatorsmile@gmail.com>
Closes #14523 from gatorsmile/refreshTempTable.
Diffstat (limited to 'sql/catalyst/src/main/scala')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala index fabab32592..00c3db0aac 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala @@ -491,7 +491,7 @@ class SessionCatalog( // If the database is defined, this is definitely not a temp table. // If the database is not defined, there is a good chance this is a temp table. if (name.database.isEmpty) { - tempTables.get(name.table).foreach(_.refresh()) + tempTables.get(formatTableName(name.table)).foreach(_.refresh()) } } @@ -508,7 +508,7 @@ class SessionCatalog( * For testing only. */ private[catalog] def getTempTable(name: String): Option[LogicalPlan] = synchronized { - tempTables.get(name) + tempTables.get(formatTableName(name)) } // ---------------------------------------------------------------------------- |