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 2020/11/19 18:00:09 UTC

[GitHub] [spark] revans2 commented on pull request #30260: [SPARK-33354][SQL] New explicit cast syntax rules in ANSI mode

revans2 commented on pull request #30260:
URL: https://github.com/apache/spark/pull/30260#issuecomment-730541975


   I just noticed that the error messages when trying to cast between timestamps and numeric types is wrong now in ANSI mode.
   
   ```
   org.apache.spark.sql.AnalysisException: cannot resolve 'CAST(`c0` AS TIMESTAMP)' due to data type mismatch: cannot cast int to timestamp,you can enable the casting by setting spark.sql.legacy.allowCastNumericToTimestamp to true,but we strongly recommend using function TIMESTAMP_SECONDS/TIMESTAMP_MILLIS/TIMESTAMP_MICROS instead.;;
   ```
   
   `spark.sql.legacy.allowCastNumericToTimestamp` has no impact on ANSI casts after this change.  It looks like a fairly simple fix.
   
   https://github.com/apache/spark/blob/3695e997d5d436be086235505bbb030c87ae8eef/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L276


----------------------------------------------------------------
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.

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