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

    https://github.com/apache/spark/pull/1889#discussion_r16094328
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala 
---
    @@ -372,7 +372,7 @@ object MapType {
        * The `valueContainsNull` is true.
        */
       def apply(keyType: DataType, valueType: DataType): MapType =
    -    MapType(keyType: DataType, valueType: DataType, true)
    +    MapType(keyType: DataType, valueType: DataType, false)
    --- End diff --
    
    Oops, I forgot to change the doc.
    
    I think the default value should be `false` because non nullable by default 
is more natural.
    For example, when we think `Map[Int, Long]` variable, it can't contain 
`null` value.
    If we want to add `null` value to the map, we have to declare the variable 
as `Map[Int, Any]` or `Map[Int, java.lang.Long]` or something like that.
    It is the same way when thinking about the data type.
    
    And this is the same as `ArrayType.containsNull`'s default value.



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to