Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15285#discussion_r83342325
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -1471,16 +1494,15 @@ private[spark] object Utils extends Logging {
        * and `endIndex` is based on the cumulative size of all the files take 
in
        * the given order. See figure below for more details.
        */
    -  def offsetBytes(files: Seq[File], start: Long, end: Long): String = {
    -    val fileLengths = files.map { _.length }
    +  def offsetBytes(files: Seq[File], fileLengths: Seq[Long], start: Long, 
end: Long): String = {
         val startIndex = math.max(start, 0)
         val endIndex = math.min(end, fileLengths.sum)
         val fileToLength = files.zip(fileLengths).toMap
         logDebug("Log files: \n" + fileToLength.mkString("\n"))
     
         val stringBuffer = new StringBuffer((endIndex - startIndex).toInt)
         var sum = 0L
    -    for (file <- files) {
    +    files.zip(fileLengths).foreach { case (file, fileLength) =>
    --- End diff --
    
    Missed this. We should assert that the number of files and lengths are 
same. Zip can silently drop stuff if they dont match


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to