diff --git a/python/pyspark/sql.py b/python/pyspark/sql.py index 18e73da154968..33647c30e0b73 100644 --- a/python/pyspark/sql.py +++ b/python/pyspark/sql.py @@ -305,7 +305,7 @@ class StructField(DataType): """ - def __init__(self, name, dataType, nullable, metadata={}): + def __init__(self, name, dataType, nullable, metadata=None): """Creates a StructField :param name: the name of this field. :param dataType: the data type of this field. @@ -325,7 +325,7 @@ def __init__(self, name, dataType, nullable, metadata={}): self.name = name self.dataType = dataType self.nullable = nullable - self.metadata = metadata + self.metadata = metadata or {} def __repr__(self): return "StructField(%s,%s,%s)" % (self.name, self.dataType,