You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2025/07/12 00:29:13 UTC

(spark-connect-swift) branch main updated: [SPARK-52775] Add `time` SQL test and answer file

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

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


The following commit(s) were added to refs/heads/main by this push:
     new f5f01cd  [SPARK-52775] Add `time` SQL test and answer file
f5f01cd is described below

commit f5f01cd9f2573c31cdc77994df11bf7eeec47ede
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Fri Jul 11 17:29:05 2025 -0700

    [SPARK-52775] Add `time` SQL test and answer file
    
    ### What changes were proposed in this pull request?
    
    This PR aims to add `time` SQL test and answer file.
    
    ### Why are the changes needed?
    
    To validate new literal syntax and methods
    - SPARK-51162 (SPIP: Add the TIME data type)
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. This is a test only change.
    
    ### How was this patch tested?
    
    Pass the CIs with Apache Spark 4.1.0-preview1 RC CI.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #214 from dongjoon-hyun/SPARK-52775.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 Tests/SparkConnectTests/Resources/queries/time.sql        | 1 +
 Tests/SparkConnectTests/Resources/queries/time.sql.answer | 5 +++++
 Tests/SparkConnectTests/SQLTests.swift                    | 8 ++++++++
 3 files changed, 14 insertions(+)

diff --git a/Tests/SparkConnectTests/Resources/queries/time.sql b/Tests/SparkConnectTests/Resources/queries/time.sql
new file mode 100644
index 0000000..c068926
--- /dev/null
+++ b/Tests/SparkConnectTests/Resources/queries/time.sql
@@ -0,0 +1 @@
+SELECT TIME '12:34:56.123456', to_time('12:34:56.123456'), make_time(12, 34, 56.123456)
diff --git a/Tests/SparkConnectTests/Resources/queries/time.sql.answer b/Tests/SparkConnectTests/Resources/queries/time.sql.answer
new file mode 100644
index 0000000..ec1204d
--- /dev/null
+++ b/Tests/SparkConnectTests/Resources/queries/time.sql.answer
@@ -0,0 +1,5 @@
++----------------------+------------------------+----------------------------+
+|TIME '12:34:56.123456'|to_time(12:34:56.123456)|make_time(12, 34, 56.123456)|
++----------------------+------------------------+----------------------------+
+|       12:34:56.123456|         12:34:56.123456|             12:34:56.123456|
++----------------------+------------------------+----------------------------+
\ No newline at end of file
diff --git a/Tests/SparkConnectTests/SQLTests.swift b/Tests/SparkConnectTests/SQLTests.swift
index bd9207b..c6dc66e 100644
--- a/Tests/SparkConnectTests/SQLTests.swift
+++ b/Tests/SparkConnectTests/SQLTests.swift
@@ -99,6 +99,10 @@ struct SQLTests {
     "variant.sql",
   ]
 
+  let queriesForSpark41Only: [String] = [
+    "time.sql",
+  ]
+
   #if !os(Linux)
     @Test
     func runAll() async throws {
@@ -111,6 +115,10 @@ struct SQLTests {
           print("Skip query \(name) due to the difference between Spark 3 and 4.")
           continue
         }
+        if await !spark.version.starts(with: "4.1") && queriesForSpark41Only.contains(name) {
+          print("Skip query \(name) due to the difference between Spark 4.0 and 4.1")
+          continue
+        }
 
         let sql = try String(contentsOf: URL(fileURLWithPath: "\(path)/\(name)"), encoding: .utf8)
         let result =


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