You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/07/28 06:58:32 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37327: [SPARK-39904] Rename inferDate to preferDate and add check for inferSchema = false

HyukjinKwon commented on code in PR #37327:
URL: https://github.com/apache/spark/pull/37327#discussion_r931848421


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVOptions.scala:
##########
@@ -153,19 +153,24 @@ class CSVOptions(
    * Disabled by default for backwards compatibility and performance. When enabled, date entries in
    * timestamp columns will be cast to timestamp upon parsing. Not compatible with
    * legacyTimeParserPolicy == LEGACY since legacy date parser will accept extra trailing characters
+   *
+   * The flag is only enabled if inferSchema is set to true.
    */
-  val inferDate = {
-    val inferDateFlag = getBool("inferDate")
-    if (SQLConf.get.legacyTimeParserPolicy == LegacyBehaviorPolicy.LEGACY && inferDateFlag) {
+  val preferDate = {
+    val preferDateFlag = getBool("preferDate")
+    if (preferDateFlag && SQLConf.get.legacyTimeParserPolicy == LegacyBehaviorPolicy.LEGACY) {
       throw QueryExecutionErrors.inferDateWithLegacyTimeParserError()
     }
-    inferDateFlag
+    if (preferDateFlag && !inferSchemaFlag) {

Review Comment:
   With `preferDate` enabled and `inferSchema` disabled, I think we can allow the parting of dates in `TimestampType` (?)



-- 
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-unsubscribe@spark.apache.org

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


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