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

wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 5f0a92c  [SPARK-38157][SQL] Explicitly set ANSI to false in test 
timestampNTZ/timestamp.sql and SQLQueryTestSuite to match the expected golden 
results
5f0a92c is described below

commit 5f0a92c435bc23dbe4049069250cf94f167df1cd
Author: Xinyi Yu <xinyi...@databricks.com>
AuthorDate: Thu Feb 10 14:49:38 2022 +0800

    [SPARK-38157][SQL] Explicitly set ANSI to false in test 
timestampNTZ/timestamp.sql and SQLQueryTestSuite to match the expected golden 
results
    
    ### What changes were proposed in this pull request?
    This PR explicitly sets the ANSI to false in the timestampNTZ/timestamp.sql 
input itself, and in the `SQLQueryTestSuite` when the input doesn't match with 
any of `PgSQLTest`, `AnsiTest` or `TimestampNTZTest`.
    
    ### Why are the changes needed?
    
    Without this change, `ThriftServerQueryTestSuite` will fail on 
timestampNTZ/timestamp.sql, when ANSI is on by default. It is because the 
timestampNTZ/timestamp.sql should only work with ANSI off according to the 
golden result file, but ThriftServerQueryTestSuite or the timestamp.sql test 
doesn't override the default ANSI setting.
    The same goes with the `SQLQueryTestSuite`.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Unit test.
    
    Closes #35471 from anchovYu/SPARK-38157-fix-thriftserver-suite-ansi.
    
    Authored-by: Xinyi Yu <xinyi...@databricks.com>
    Signed-off-by: Wenchen Fan <wenc...@databricks.com>
---
 sql/core/src/test/resources/sql-tests/inputs/timestampNTZ/timestamp.sql | 1 +
 sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala    | 1 +
 2 files changed, 2 insertions(+)

diff --git 
a/sql/core/src/test/resources/sql-tests/inputs/timestampNTZ/timestamp.sql 
b/sql/core/src/test/resources/sql-tests/inputs/timestampNTZ/timestamp.sql
index 79193c9..47988ee 100644
--- a/sql/core/src/test/resources/sql-tests/inputs/timestampNTZ/timestamp.sql
+++ b/sql/core/src/test/resources/sql-tests/inputs/timestampNTZ/timestamp.sql
@@ -1 +1,2 @@
+--SET spark.sql.ansi.enabled = false
 --IMPORT timestamp.sql
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
index 7a5684e..d6a7c690 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
@@ -388,6 +388,7 @@ class SQLQueryTestSuite extends QueryTest with 
SharedSparkSession with SQLHelper
         localSparkSession.conf.set(SQLConf.TIMESTAMP_TYPE.key,
           TimestampTypes.TIMESTAMP_NTZ.toString)
       case _ =>
+        localSparkSession.conf.set(SQLConf.ANSI_ENABLED.key, false)
     }
 
     if (configSet.nonEmpty) {

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

Reply via email to