HyukjinKwon commented on a change in pull request #27031: [SPARK-30373][SQL]
Avoid unnecessary sort for ParquetUtils.splitFiles
URL: https://github.com/apache/spark/pull/27031#discussion_r361915141
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetUtils.scala
##########
@@ -112,15 +114,26 @@ object ParquetUtils {
metadata: Seq[FileStatus],
commonMetadata: Seq[FileStatus])
- private def splitFiles(allFiles: Seq[FileStatus]): FileTypes = {
- val leaves = allFiles.toArray.sortBy(_.getPath.toString)
Review comment:
It was actually @liancheng's advice (wow 5 years ago). Sorting it will gives
you a deterministic result. Relying on the native listing order doesn't look a
great idea. From a cursory look, HDFS's vs Java's `File.list` (by
`RawLocalFileSystem`) behaviours look inconsistent as an example.
In addition, sorting itself won't cause a lot of performance penalty given
most of performance penalty comes from listing up files, and given that the
number of files should be, really, really high which isn't a pretty common case.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]