Github user liancheng commented on a diff in the pull request: https://github.com/apache/spark/pull/12153#discussion_r59057227 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileSourceStrategy.scala --- @@ -137,10 +140,14 @@ private[sql] object FileSourceStrategy extends Strategy with Logging { val splitFiles = selectedPartitions.flatMap { partition => partition.files.flatMap { file => + val blockLocations = getBlockLocations(file) (0L to file.getLen by maxSplitBytes).map { offset => val remaining = file.getLen - offset val size = if (remaining > maxSplitBytes) maxSplitBytes else remaining - PartitionedFile(partition.values, file.getPath.toUri.toString, offset, size) + // Finds out a list of location hosts where lives the first block that contains the + // starting point the file block starts at `offset` with length `size`. + val hosts = getBlockHosts(blockLocations, offset) + PartitionedFile(partition.values, file.getPath.toUri.toString, offset, size, hosts) --- End diff -- This is a really good pointer, thanks!
--- 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