Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7420#discussion_r34754757
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
---
@@ -747,15 +742,9 @@ object HiveTypeCoercion {
case (StringType, BinaryType) => Cast(e, BinaryType)
case (any, StringType) if any != StringType => Cast(e, StringType)
- // Type collection.
- // First see if we can find our input type in the type collection.
If we can, then just
- // use the current expression; otherwise, find the first one we
can implicitly cast.
- case (_, TypeCollection(types)) =>
- if (types.exists(_.isSameType(inType))) {
- e
- } else {
- types.flatMap(implicitCast(e, _)).headOption.orNull
- }
+ // When we reach here, input type is not acceptable for any types
in this type collection,
+ // try to find the first one we can implicitly cast.
+ case (_, TypeCollection(types)) => types.flatMap(implicitCast(e,
_)).headOption.orNull
--- End diff --
Is this correct? Imagine we have TypeCollection(LongType, StringType), and
the input is StringType
Wouldn't this just cast input to a longtype?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]