dongjoon-hyun commented on code in PR #44636:
URL: https://github.com/apache/spark/pull/44636#discussion_r1452773164
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/FileStreamSource.scala:
##########
@@ -113,16 +117,32 @@ class FileStreamSource(
// Visible for testing and debugging in production.
val seenFiles = new SeenFilesMap(maxFileAgeMs, fileNameOnly)
- private var allFilesForTriggerAvailableNow: Seq[(SparkPath, Long)] = _
+ private var allFilesForTriggerAvailableNow: Seq[NewFileEntry] = _
metadataLog.restore().foreach { entry =>
seenFiles.add(entry.sparkPath, entry.timestamp)
}
seenFiles.purge()
- logInfo(s"maxFilesPerBatch = $maxFilesPerBatch, maxFileAgeMs =
$maxFileAgeMs")
+ logInfo(s"maxFilesPerBatch = $maxFilesPerBatch, " +
+ s"maxBytesPerBatch = $maxBytesPerBatch, maxFileAgeMs = $maxFileAgeMs")
+
+ private var unreadFiles: Seq[NewFileEntry] = _
- private var unreadFiles: Seq[(SparkPath, Long)] = _
+ /**
+ * Split files into a selected/unselected pair according to a total size
threshold.
+ */
+ private def takeFilesUntilMax(files: Seq[NewFileEntry], maxSize: Long):
+ (Seq[NewFileEntry], Seq[NewFileEntry]) = {
+ var idx = 0
+ var totalSize = 0L
+ val (bFiles, usFiles) = files.span { case NewFileEntry(_, size, _) =>
+ idx += 1
+ totalSize += size
+ idx == 1 || totalSize <= maxSize
Review Comment:
This is better than the silent overflow. However, this looks insufficient to
me because this new code enforces Apache Spark community to add a new migration
documentation about this kind of new regression .
Although I understand why you think the overflow is unlikely and are
reluctant to change the logic, the Apache Spark community shares this code
among the world-wide users. We cannot merge this kind of regression.
To simply put, when we able to handle handle this gracefully without any
exception and regression, why do we choose this logic and expose the users the
risk of production job failures due to `ArithmeticException`, @MaxNevermind ?
--
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]