You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/04/10 10:52:23 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2312] Spark data type TimestampNTZ supported version changes as 3.4.0

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

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new e1e0b3589 [KYUUBI #2312] Spark data type TimestampNTZ supported version changes as 3.4.0
e1e0b3589 is described below

commit e1e0b3589ab11afacb2ccc82e2623236f60b1a34
Author: Nick Song <ch...@163.com>
AuthorDate: Sun Apr 10 18:52:14 2022 +0800

    [KYUUBI #2312] Spark data type TimestampNTZ supported version changes as 3.4.0
    
    ### _Why are the changes needed?_
    
    fix #2312
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #2313 from Nick-0723/2312.
    
    Closes #2312
    
    91e607a8 [Nick Song] Spark data type TimestampNTZ supported version changes as 3.4.0
    
    Authored-by: Nick Song <ch...@163.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../apache/kyuubi/engine/spark/schema/SchemaHelper.scala   |  2 +-
 .../engine/spark/operation/SparkOperationSuite.scala       | 14 +++++++++-----
 .../org/apache/kyuubi/operation/SparkQueryTests.scala      |  4 ++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/schema/SchemaHelper.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/schema/SchemaHelper.scala
index 411175704..29d720c53 100644
--- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/schema/SchemaHelper.scala
+++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/schema/SchemaHelper.scala
@@ -27,7 +27,7 @@ import org.apache.spark.sql.types._
 object SchemaHelper {
 
   /**
-   * Spark 3.3.0 DataType TimestampNTZType's class name.
+   * Spark 3.4.0 DataType TimestampNTZType's class name.
    */
   final val TIMESTAMP_NTZ = "TimestampNTZType$"
 
diff --git a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkOperationSuite.scala b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkOperationSuite.scala
index 51a54148f..27766e7c6 100644
--- a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkOperationSuite.scala
+++ b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/operation/SparkOperationSuite.scala
@@ -80,9 +80,13 @@ class SparkOperationSuite extends WithSparkSQLEngine with HiveMetadataTests with
     // since spark3.3.0
     if (SPARK_ENGINE_MAJOR_MINOR_VERSION._1 > 3 ||
       (SPARK_ENGINE_MAJOR_MINOR_VERSION._1 == 3 && SPARK_ENGINE_MAJOR_MINOR_VERSION._2 >= 3)) {
-      schema = schema.add("c18", "timestamp_ntz", nullable = true, "18")
-        .add("c19", "interval day", nullable = true, "19")
-        .add("c20", "interval year", nullable = true, "20")
+      schema = schema.add("c18", "interval day", nullable = true, "18")
+        .add("c19", "interval year", nullable = true, "19")
+    }
+    // since spark3.4.0
+    if (SPARK_ENGINE_MAJOR_MINOR_VERSION._1 > 3 ||
+      (SPARK_ENGINE_MAJOR_MINOR_VERSION._1 == 3 && SPARK_ENGINE_MAJOR_MINOR_VERSION._2 >= 4)) {
+      schema = schema.add("c20", "timestamp_ntz", nullable = true, "20")
     }
 
     val ddl =
@@ -120,9 +124,9 @@ class SparkOperationSuite extends WithSparkSQLEngine with HiveMetadataTests with
           STRUCT,
           BINARY,
           STRUCT,
-          TIMESTAMP,
           OTHER,
-          OTHER)
+          OTHER,
+          TIMESTAMP)
 
         var pos = 0
 
diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala
index 7a5c0b947..1cc55554f 100644
--- a/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala
+++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkQueryTests.scala
@@ -175,8 +175,8 @@ trait SparkQueryTests extends HiveJDBCTestHelper {
   }
 
   test("execute statement - select timestamp_ntz") {
-    assume(SPARK_ENGINE_MAJOR_MINOR_VERSION._1 >= 3
-      && SPARK_ENGINE_MAJOR_MINOR_VERSION._2 > 2)
+    assume(SPARK_ENGINE_MAJOR_MINOR_VERSION._1 > 3 ||
+      (SPARK_ENGINE_MAJOR_MINOR_VERSION._1 == 3 && SPARK_ENGINE_MAJOR_MINOR_VERSION._2 >= 4))
     withJdbcStatement() { statement =>
       val resultSet = statement.executeQuery(
         "SELECT make_timestamp_ntz(2022, 03, 24, 18, 08, 31.800) AS col")