cloud-fan commented on a change in pull request #34459:
URL: https://github.com/apache/spark/pull/34459#discussion_r741295477



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -2052,6 +2068,7 @@ object AnsiCast {
    * Spark's ANSI mode follows the syntax rules, except it specially allow the 
following
    * straightforward type conversions which are disallowed as per the SQL 
standard:
    *   - Numeric <=> Boolean
+   *   - Numeric <=> Timestamp

Review comment:
       shall we remove this change? By default we don't allow it in the ansi 
mode.

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -2069,6 +2086,8 @@ object AnsiCast {
     case (StringType, TimestampType) => true
     case (DateType, TimestampType) => true
     case (TimestampNTZType, TimestampType) => true
+    case (_: NumericType, TimestampType) if 
SQLConf.get.allowCastBetweenDatetimeAndNumericInAnsi =>

Review comment:
       case ... => SQLConf.get.allowCastBetweenDatetimeAndNumericInAnsi

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
##########
@@ -971,6 +971,10 @@ object QueryExecutionErrors {
     new DateTimeException(s"Cannot cast $s to $to.")
   }
 
+  def cannotCastDoubleToTimestampError(d: Double, to: DataType): Throwable = {

Review comment:
       +1




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to