Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/2701#discussion_r19314368
--- Diff: python/pyspark/sql.py ---
@@ -305,12 +305,15 @@ class StructField(DataType):
"""
- def __init__(self, name, dataType, nullable):
+ def __init__(self, name, dataType, nullable, metadata={}):
--- End diff --
Use {} as default value will have side effects, such as:
```
>>> a = StructField('a', StringType(), True)
>>> b = StructField('b', StringType(), True)
>>> a.metadata['name'] = 'a'
>>> b.metadata['name']
'a'
```
So if the meta could be modified somewhere, here you should use `None` as
default value.
```
def xxx(xxx, metadata=None):
....
self.metadata = metadata or {}
```
---
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]