Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7420#discussion_r34686308
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
 ---
    @@ -713,27 +713,22 @@ object HiveTypeCoercion {
           @Nullable val ret: Expression = (inType, expectedType) match {
     
             // If the expected type is already a parent of the input type, no 
need to cast.
    -        case _ if expectedType.isSameType(inType) => e
    +        case _ if expectedType.acceptsType(inType) => e
    --- End diff --
    
    Why we need `isSameType`? I think the logic should be:
    
    1. first check whether the input type is acceptable(i.e. 
expectedType.acceptsType(inType) returns true). If it is, do nothing here.
    2. If input type is not acceptable, follow special rules below.
    
    It looks to me we only need `acceptsType`.


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

Reply via email to