gene-db commented on code in PR #52260:
URL: https://github.com/apache/spark/pull/52260#discussion_r2487151567
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -2348,6 +2348,18 @@ def test_variant_type(self):
with self.assertRaises(PySparkValueError, msg="Rows cannot be of type
VariantVal"):
self.spark.createDataFrame([VariantVal.parseJson("2")], "v
variant")
+ def test_variant_to_pandas(self):
+ import pandas as pd
+
+ expected_values = [
+ ("str", '"%s"' % ("0123456789" * 10), "0123456789" * 10),
+ ("short_str", '"abc"', "abc"),
+ ]
+ json_str = "{%s}" % ",".join(['"%s": %s' % (t[0], t[1]) for t in
expected_values])
+ df = self.spark.createDataFrame([({"json": json_str})])
+ pandas = df.toPandas()
+ self.assertIsInstance(pandas, pd.DataFrame)
Review Comment:
This is checking the type. Can we also check the data is expected?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]