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

dongjoon 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 d41d5ecda8c1 [SPARK-47390][SQL][FOLLOWUP] Fix TIME_WITH_TIMEZONE 
mapping in PostgresDialect
d41d5ecda8c1 is described below

commit d41d5ecda8c11d7e8f6a1fafa1d2be97c0f49f04
Author: Kent Yao <y...@apache.org>
AuthorDate: Thu Mar 14 10:30:48 2024 -0700

    [SPARK-47390][SQL][FOLLOWUP] Fix TIME_WITH_TIMEZONE mapping in 
PostgresDialect
    
    ### What changes were proposed in this pull request?
    
    This PR fixes a bug in SPARK-47390, we shall separate TIME from TIMESTAMP 
case-match branch
    
    ### Why are the changes needed?
    
    bugfix
    
    ### Does this PR introduce _any_ user-facing change?
    
    no
    
    ### How was this patch tested?
    
    local test with #45519 merged together
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #45522 from yaooqinn/SPARK-47390-F.
    
    Authored-by: Kent Yao <y...@apache.org>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala
index 7d8ed70b2bd1..9b286620a140 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala
@@ -58,10 +58,14 @@ private object PostgresDialect extends JdbcDialect with 
SQLConfHelper {
         // See SPARK-34333 and https://github.com/pgjdbc/pgjdbc/issues/100
         Some(StringType)
       case Types.TIMESTAMP
-        if "timestamptz".equalsIgnoreCase(typeName) || 
"timetz".equalsIgnoreCase(typeName) =>
+        if "timestamptz".equalsIgnoreCase(typeName) =>
         // timestamptz represents timestamp with time zone, currently it maps 
to Types.TIMESTAMP.
         // We need to change to Types.TIMESTAMP_WITH_TIMEZONE if the upstream 
changes.
         Some(TimestampType)
+      case Types.TIME if "timetz".equalsIgnoreCase(typeName) =>
+        // timetz represents time with time zone, currently it maps to 
Types.TIME.
+        // We need to change to Types.TIME_WITH_TIMEZONE if the upstream 
changes.
+        Some(TimestampType)
       case Types.OTHER => Some(StringType)
       case _ if "text".equalsIgnoreCase(typeName) => Some(StringType) // 
sqlType is Types.VARCHAR
       case Types.ARRAY =>


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

Reply via email to