diff --git a/python/pyspark/sql/types.py b/python/pyspark/sql/types.py index 1f86894855cbed0356e6a8b708297112d9b87623..5bc0773fa8660507973c3adf89000eeee8d9349e 100644 --- a/python/pyspark/sql/types.py +++ b/python/pyspark/sql/types.py @@ -1127,15 +1127,15 @@ def _verify_type(obj, dataType): return _type = type(dataType) - assert _type in _acceptable_types, "unknown datatype: %s" % dataType + assert _type in _acceptable_types, "unknown datatype: %s for object %r" % (dataType, obj) if _type is StructType: if not isinstance(obj, (tuple, list)): - raise TypeError("StructType can not accept object in type %s" % type(obj)) + raise TypeError("StructType can not accept object %r in type %s" % (obj, type(obj))) else: # subclass of them can not be fromInternald in JVM if type(obj) not in _acceptable_types[_type]: - raise TypeError("%s can not accept object in type %s" % (dataType, type(obj))) + raise TypeError("%s can not accept object %r in type %s" % (dataType, obj, type(obj))) if isinstance(dataType, ArrayType): for i in obj: