ueshin commented on code in PR #40166:
URL: https://github.com/apache/spark/pull/40166#discussion_r1117822759
##########
python/pyspark/sql/tests/test_readwriter.py:
##########
@@ -31,75 +31,77 @@ def test_save_and_load(self):
df = self.df
tmpPath = tempfile.mkdtemp()
shutil.rmtree(tmpPath)
- df.write.json(tmpPath)
- actual = self.spark.read.json(tmpPath)
- self.assertEqual(sorted(df.collect()), sorted(actual.collect()))
-
- schema = StructType([StructField("value", StringType(), True)])
- actual = self.spark.read.json(tmpPath, schema)
- self.assertEqual(sorted(df.select("value").collect()),
sorted(actual.collect()))
-
- df.write.json(tmpPath, "overwrite")
- actual = self.spark.read.json(tmpPath)
- self.assertEqual(sorted(df.collect()), sorted(actual.collect()))
-
- df.write.save(
- format="json",
- mode="overwrite",
- path=tmpPath,
- noUse="this options will not be used in save.",
- )
- actual = self.spark.read.load(
- format="json", path=tmpPath, noUse="this options will not be used
in load."
- )
- self.assertEqual(sorted(df.collect()), sorted(actual.collect()))
-
- defaultDataSourceName = self.spark.conf.get(
- "spark.sql.sources.default", "org.apache.spark.sql.parquet"
- )
- self.spark.sql("SET
spark.sql.sources.default=org.apache.spark.sql.json")
- actual = self.spark.read.load(path=tmpPath)
- self.assertEqual(sorted(df.collect()), sorted(actual.collect()))
- self.spark.sql("SET spark.sql.sources.default=" +
defaultDataSourceName)
+ try:
Review Comment:
The changes in this file is to make the cleanup done properly.
--
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]