[ 
https://issues.apache.org/jira/browse/SPARK-23035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

xubo245 updated SPARK-23035:
----------------------------
    Description: 
 

Problem: it throw TempTableAlreadyExistsException and output "Temporary table 
'$table' already exists" when we create temp view by using 
org.apache.spark.sql.catalyst.catalog.GlobalTempViewManager#create, it's 
improper.
{code:java}
 /**
   * Creates a global temp view, or issue an exception if the view already 
exists and
   * `overrideIfExists` is false.
   */
  def create(
      name: String,
      viewDefinition: LogicalPlan,
      overrideIfExists: Boolean): Unit = synchronized {
    if (!overrideIfExists && viewDefinitions.contains(name)) {
      throw new TempTableAlreadyExistsException(name)
    }
    viewDefinitions.put(name, viewDefinition)
  }


{code}

*No need to fix: 
* warning: TEMPORARY TABLE ... USING ... is deprecated and use 
TempViewAlreadyExistsException when create temp view

There are warning when run test: test("rename temporary view - destination 
table with database name")

02:11:38.136 WARN org.apache.spark.sql.execution.SparkSqlAstBuilder: CREATE 
TEMPORARY TABLE ... USING ... is deprecated, please use CREATE TEMPORARY VIEW 
... USING ... instead
other test cases also have this warning


  was:
 

Problem: it throw TempTableAlreadyExistsException and output "Temporary table 
'$table' already exists" when we create temp view by using 
org.apache.spark.sql.catalyst.catalog.GlobalTempViewManager#create, it's 
improper.
{code:java}
 /**
   * Creates a global temp view, or issue an exception if the view already 
exists and
   * `overrideIfExists` is false.
   */
  def create(
      name: String,
      viewDefinition: LogicalPlan,
      overrideIfExists: Boolean): Unit = synchronized {
    if (!overrideIfExists && viewDefinitions.contains(name)) {
      throw new TempTableAlreadyExistsException(name)
    }
    viewDefinitions.put(name, viewDefinition)
  }


{code}

*No need to fix: *
 warning: TEMPORARY TABLE ... USING ... is deprecated and use 
TempViewAlreadyExistsException when create temp view

There are warning when run test: test("rename temporary view - destination 
table with database name")

02:11:38.136 WARN org.apache.spark.sql.execution.SparkSqlAstBuilder: CREATE 
TEMPORARY TABLE ... USING ... is deprecated, please use CREATE TEMPORARY VIEW 
... USING ... instead
other test cases also have this warning



> Fix improper information of TempTableAlreadyExistsException
> -----------------------------------------------------------
>
>                 Key: SPARK-23035
>                 URL: https://issues.apache.org/jira/browse/SPARK-23035
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.1
>            Reporter: xubo245
>            Assignee: xubo245
>            Priority: Major
>             Fix For: 2.3.0
>
>
>  
> Problem: it throw TempTableAlreadyExistsException and output "Temporary table 
> '$table' already exists" when we create temp view by using 
> org.apache.spark.sql.catalyst.catalog.GlobalTempViewManager#create, it's 
> improper.
> {code:java}
>  /**
>    * Creates a global temp view, or issue an exception if the view already 
> exists and
>    * `overrideIfExists` is false.
>    */
>   def create(
>       name: String,
>       viewDefinition: LogicalPlan,
>       overrideIfExists: Boolean): Unit = synchronized {
>     if (!overrideIfExists && viewDefinitions.contains(name)) {
>       throw new TempTableAlreadyExistsException(name)
>     }
>     viewDefinitions.put(name, viewDefinition)
>   }
> {code}
> *No need to fix: 
> * warning: TEMPORARY TABLE ... USING ... is deprecated and use 
> TempViewAlreadyExistsException when create temp view
> There are warning when run test: test("rename temporary view - destination 
> table with database name")
> 02:11:38.136 WARN org.apache.spark.sql.execution.SparkSqlAstBuilder: CREATE 
> TEMPORARY TABLE ... USING ... is deprecated, please use CREATE TEMPORARY VIEW 
> ... USING ... instead
> other test cases also have this warning



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to