Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14962#discussion_r77858872
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLViewSuite.scala 
---
    @@ -95,12 +95,12 @@ class SQLViewSuite extends QueryTest with SQLTestUtils 
with TestHiveSingleton {
           e = intercept[AnalysisException] {
             sql(s"""LOAD DATA LOCAL INPATH "$testData" INTO TABLE $viewName""")
           }.getMessage
    -      assert(e.contains(s"Target table in LOAD DATA cannot be temporary: 
`$viewName`"))
    +      assert(e.contains(s"Target table in LOAD DATA does not exist: 
`$viewName`"))
    --- End diff --
    
    ```Scala
        if (!catalog.tableExists(table)) {
          throw new AnalysisException(s"Target table in LOAD DATA does not 
exist: $table")
        }
        val targetTable = catalog.getTableMetadataOption(table).getOrElse {
          throw new AnalysisException(s"Target table in LOAD DATA cannot be 
temporary: $table")
        }
    ```
    
    Currently, the message in the `getOrElse` becomes unreachable. Maybe, we 
can simplify it by
    
    ```Scala
        if (!catalog.tableExists(table)) {
          throw new AnalysisException(s"Target table in LOAD DATA does not 
exist: $table")
        }
        val targetTable = catalog.getTableMetadata(table)
    ```
    Or
    ```
        val targetTable = catalog.getTableMetadata(table)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to