dongjoon-hyun commented on code in PR #47341: URL: https://github.com/apache/spark/pull/47341#discussion_r1677196178
########## mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala: ########## @@ -411,7 +411,10 @@ private[ml] object DefaultParamsWriter { paramMap: Option[JValue] = None): Unit = { val metadataPath = new Path(path, "metadata").toString val metadataJson = getMetadataToSave(instance, sc, extraMetadata, paramMap) - sc.parallelize(Seq(metadataJson), 1).saveAsTextFile(metadataPath) + val spark = SparkSession.getActiveSession.get + // Note that we should write single file. If there are more than one row + // it produces more partitions. + spark.createDataFrame(Seq(Tuple1(metadataJson))).write.text(metadataPath) Review Comment: Can we focus on `R` part first by excluding this file from this PR, @HyukjinKwon ? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org