Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4826#discussion_r25639644
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/dataTypes.scala ---
    @@ -198,6 +198,43 @@ object DataType {
           case (left, right) => left == right
         }
       }
    +
    +  /**
    +   * Compares two types, ignoring compatible nullability of ArrayType, 
MapType, StructType.
    +   *
    +   * Compatible nullability is defined as follows:
    +   *   - If `from` and `to` are ArrayTypes, `from` has a compatible 
nullability with `to`
    +   *   if and only if `to.containsNull` is true, or both of 
`from.containsNull` and
    +   *   `to.containsNull` are false.
    +   *   - If `from` and `to` are MapTypes, `from` has a compatible 
nullability with `to`
    +   *   if and only if `to.valueContainsNull` is true, or both of 
`from.valueContainsNull` and
    +   *   `to.valueContainsNull` are false.
    +   *   - If `from` and `to` are StructTypes, `from` has a compatible 
nullability with `to`
    +   *   if and only if for all every pair of fields, `to.nullable` is true, 
or both
    +   *   of `fromField.nullable` and `toField.nullable` are false.
    +   */
    +  private[sql] def equalsIgnoreCompatibleNullability(from: DataType, to: 
DataType): Boolean = {
    --- End diff --
    
    We can introduce a method to the class of `DataType` based on this one 
later (I am not sure what will be a good name. I thought about 
`compatibleWith`, but I feel it is not very accurate). 


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