dongjoon-hyun commented on code in PR #47347:
URL: https://github.com/apache/spark/pull/47347#discussion_r1678140627


##########
mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala:
##########
@@ -198,10 +198,10 @@ object NaiveBayesModel extends Loader[NaiveBayesModel] {
       val metadata = compact(render(
         ("class" -> thisClassName) ~ ("version" -> thisFormatVersion) ~
           ("numFeatures" -> data.theta(0).length) ~ ("numClasses" -> 
data.pi.length)))
-      sc.parallelize(Seq(metadata), 1).saveAsTextFile(metadataPath(path))
+      
spark.createDataFrame(Seq(Tuple1(metadata))).write.text(metadataPath(path))

Review Comment:
   Could you remove this piggy back, @HyukjinKwon ?



##########
mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala:
##########
@@ -243,10 +243,10 @@ object NaiveBayesModel extends Loader[NaiveBayesModel] {
       val metadata = compact(render(
         ("class" -> thisClassName) ~ ("version" -> thisFormatVersion) ~
           ("numFeatures" -> data.theta(0).length) ~ ("numClasses" -> 
data.pi.length)))
-      sc.parallelize(Seq(metadata), 1).saveAsTextFile(metadataPath(path))
+      
spark.createDataFrame(Seq(Tuple1(metadata))).write.text(metadataPath(path))

Review Comment:
   ditto.



-- 
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

Reply via email to