This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 45bdb58  [SPARK-33358][SQL] Return code when command process failed
45bdb58 is described below

commit 45bdb583624436510d38d8cf719de1020d2058ec
Author: artiship <[email protected]>
AuthorDate: Sun Nov 15 16:56:35 2020 -0800

    [SPARK-33358][SQL] Return code when command process failed
    
    Exit Spark SQL CLI processing loop if one of the commands (sub sql 
statement) process failed
    
    This is a regression at Apache Spark 3.0.0.
    
    ```
    $ cat 1.sql
    select * from nonexistent_table;
    select 2;
    ```
    
    **Apache Spark 2.4.7**
    ```
    spark-2.4.7-bin-hadoop2.7:$ bin/spark-sql -f 1.sql
    20/11/15 16:14:38 WARN NativeCodeLoader: Unable to load native-hadoop 
library for your platform... using builtin-java classes where applicable
    Error in query: Table or view not found: nonexistent_table; line 1 pos 14
    ```
    
    **Apache Spark 3.0.1**
    ```
    $ bin/spark-sql -f 1.sql
    Error in query: Table or view not found: nonexistent_table; line 1 pos 14;
    'Project [*]
    +- 'UnresolvedRelation [nonexistent_table]
    
    2
    Time taken: 2.786 seconds, Fetched 1 row(s)
    ```
    
    **Apache Hive 1.2.2**
    ```
    apache-hive-1.2.2-bin:$ bin/hive -f 1.sql
    
    Logging initialized using configuration in 
jar:file:/Users/dongjoon/APACHE/hive-release/apache-hive-1.2.2-bin/lib/hive-common-1.2.2.jar!/hive-log4j.properties
    FAILED: SemanticException [Error 10001]: Line 1:14 Table not found 
'nonexistent_table'
    ```
    
    Yes. This is a fix of regression.
    
    Pass the UT.
    
    Closes #30263 from artiship/SPARK-33358.
    
    Authored-by: artiship <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
    (cherry picked from commit 1ae6d64b5fb9c20e41deffaf670a42b0b545477f)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
 
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
index c7848af..6abb905 100644
--- 
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
+++ 
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
@@ -499,7 +499,7 @@ private[hive] class SparkSQLCLIDriver extends CliDriver 
with Logging {
             val ignoreErrors = HiveConf.getBoolVar(conf, 
HiveConf.ConfVars.CLIIGNOREERRORS)
             if (ret != 0 && !ignoreErrors) {
               CommandProcessorFactory.clean(conf.asInstanceOf[HiveConf])
-              ret
+              return ret
             }
           }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to