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

    https://github.com/apache/spark/pull/19792#discussion_r152397263
  
    --- Diff: python/pyspark/sql/types.py ---
    @@ -1108,19 +1109,22 @@ def _has_nulltype(dt):
             return isinstance(dt, NullType)
     
     
    -def _merge_type(a, b):
    +def _merge_type(a, b, name=None):
         if isinstance(a, NullType):
             return b
         elif isinstance(b, NullType):
             return a
         elif type(a) is not type(b):
             # TODO: type cast (such as int -> long)
    -        raise TypeError("Can not merge type %s and %s" % (type(a), 
type(b)))
    +        if name is not None:
    --- End diff --
    
    Easier to read as:
    
    ```
    if name is None:
        raise TypeError("Can not merge type %s and %s" % (type(a), type(b)))
    else:
        raise TypeError("Can not merge type %s and %s in column %s" % (type(a), 
type(b), name))
    ```


---

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

Reply via email to