sandip-db commented on code in PR #50052:
URL: https://github.com/apache/spark/pull/50052#discussion_r2024101429


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/UnivocityParser.scala:
##########
@@ -499,7 +503,8 @@ class UnivocityParser(
             parseDate()
           }
         } catch {
-          case NonFatal(_) => parseDate()
+          case NonFatal(_) =>
+            if (options.preferDate) parseDate() else parseTimestampNTZ()

Review Comment:
   Add Variant test with preferDate option.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/UnivocityParser.scala:
##########
@@ -499,7 +503,8 @@ class UnivocityParser(
             parseDate()

Review Comment:
   ```suggestion
               if (options.preferDate) parseDate() else parseTimestampNTZ()
   ```



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/UnivocityParser.scala:
##########
@@ -512,6 +517,19 @@ class UnivocityParser(
         }
       }
 
+      def parseTimestampNTZ(): DataType = {
+        if (isDefaultNTZ) {
+          try {
+            
builder.appendTimestampNtz(timestampNTZFormatter.parseWithoutTimeZone(s, false))

Review Comment:
   Add test for TimestampNTZType and TimestampType scenarios.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to