Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/18521#discussion_r125383919
--- Diff: python/pyspark/sql/session.py ---
@@ -514,17 +514,21 @@ def createDataFrame(self, data, schema=None,
samplingRatio=None, verifySchema=Tr
schema = [str(x) for x in data.columns]
data = [r.tolist() for r in data.to_records(index=False)]
- verify_func = _verify_type if verifySchema else lambda _, t: True
if isinstance(schema, StructType):
+ verify_func = _make_type_verifier(schema) if verifySchema else
lambda _: True
+
def prepare(obj):
- verify_func(obj, schema)
+ verify_func(obj)
return obj
elif isinstance(schema, DataType):
dataType = schema
schema = StructType().add("value", schema)
+ verify_func = _make_type_verifier(
+ dataType, name="field value") if verifySchema else lambda
_: True
--- End diff --
I don't think so. It should return `None` I think but I just wanted to
avoid other changes for reviewing.
---
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]