cloud-fan commented on code in PR #45612:
URL: https://github.com/apache/spark/pull/45612#discussion_r1531859481


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AnsiTypeCoercion.scala:
##########
@@ -180,37 +180,18 @@ object AnsiTypeCoercion extends TypeCoercionBase {
       // cast the input to decimal.
       case (n: NumericType, DecimalType) => Some(DecimalType.forType(n))
 
-      // Cast null type (usually from null literals) into target types
-      // By default, the result type is `target.defaultConcreteType`. When the 
target type is
-      // `TypeCollection`, there is another branch to find the "closet 
convertible data type" below.
-      case (NullType, target) if !target.isInstanceOf[TypeCollection] =>

Review Comment:
   This is covered by `Cast.canANSIStoreAssign`



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AnsiTypeCoercion.scala:
##########
@@ -180,37 +180,18 @@ object AnsiTypeCoercion extends TypeCoercionBase {
       // cast the input to decimal.
       case (n: NumericType, DecimalType) => Some(DecimalType.forType(n))
 
-      // Cast null type (usually from null literals) into target types
-      // By default, the result type is `target.defaultConcreteType`. When the 
target type is
-      // `TypeCollection`, there is another branch to find the "closet 
convertible data type" below.
-      case (NullType, target) if !target.isInstanceOf[TypeCollection] =>
-        Some(target.defaultConcreteType)
-
-      // This type coercion system will allow implicit converting String type 
as other
-      // primitive types, in case of breaking too many existing Spark SQL 
queries.
-      case (StringType, a: AtomicType) =>
-        Some(a)
-
-      // If the target type is any Numeric type, convert the String type as 
Double type.
-      case (StringType, NumericType) =>
-        Some(DoubleType)
-
-      // If the target type is any Decimal type, convert the String type as 
the default
-      // Decimal type.
-      case (StringType, DecimalType) =>
-        Some(DecimalType.SYSTEM_DEFAULT)
-
-      // If the target type is any timestamp type, convert the String type as 
the default
-      // Timestamp type.
-      case (StringType, AnyTimestampType) =>
-        Some(AnyTimestampType.defaultConcreteType)
-
-      case (DateType, AnyTimestampType) =>

Review Comment:
   ditto



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