cloud-fan commented on code in PR #53150:
URL: https://github.com/apache/spark/pull/53150#discussion_r2550084041
##########
mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala:
##########
@@ -1142,4 +1143,66 @@ private[spark] object ReadWriteUtils {
spark.read.parquet(path).as[T].collect()
}
}
+
+ def saveDataFrame(path: String, df: DataFrame): Unit = {
+ if (localSavingModeState.get()) {
+ val filePath = Paths.get(path)
+ Files.createDirectories(filePath.getParent)
+
+ Using.resource(
+ new DataOutputStream(new BufferedOutputStream(new
FileOutputStream(filePath.toFile)))
+ ) { dos =>
+ dos.writeUTF("ARROW") // format
+
+ val schema: StructType = df.schema
+ dos.writeUTF(schema.json)
+
+ val iter = DatasetUtils.toArrowBatchRDD(df, "UTC").toLocalIterator
Review Comment:
does the arrow library provide APIs to write to local file?
--
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]