-
Notifications
You must be signed in to change notification settings - Fork 302
[AutoSparkUT] Fix GPU missing-file recovery guidance [reduced-it] #15835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wjxiz1992
merged 10 commits into
NVIDIA:main
from
wjxiz1992:codex/fix-15511-orc-missing-file-guidance
Sep 9, 2026
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
07c1035
Fix GPU missing-file recovery guidance
wjxiz1992 234f8dc
Handle missing files thrown from datasource next
wjxiz1992 98650a4
Require explicit missing-file recovery policy
wjxiz1992 c1e1a06
Fix Spark 4 missing-file structured errors
wjxiz1992 ad6d7a5
Fix AsyncRunners copyright year
wjxiz1992 844a13f
Merge branch 'main' into codex/fix-15511-orc-missing-file-guidance
wjxiz1992 3118411
Merge branch 'main' into codex/fix-15511-orc-missing-file-guidance
wjxiz1992 43d7940
Fix GpuDataSourceRDD import order
wjxiz1992 4896e36
Address missing-file review feedback
wjxiz1992 51b6b89
Preserve multi-file reader factory identity
wjxiz1992 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,9 @@ | |
|
|
||
| package com.nvidia.spark.rapids.shims | ||
|
|
||
| import java.io.FileNotFoundException | ||
| import java.util.concurrent.ExecutionException | ||
|
|
||
| import com.nvidia.spark.rapids.{FileSystemBytesReadTracker, MetricsBatchIterator, PartitionIterator} | ||
| import com.nvidia.spark.rapids.ScalableTaskCompletion.onTaskCompletion | ||
|
|
||
|
|
@@ -33,7 +36,8 @@ import org.apache.spark.sql.vectorized.ColumnarBatch | |
| class GpuDataSourceRDD( | ||
| sc: SparkContext, | ||
| @transient private val inputPartitions: Seq[Seq[InputPartition]], | ||
| partitionReaderFactory: PartitionReaderFactory | ||
| partitionReaderFactory: PartitionReaderFactory, | ||
| includeRefreshHint: Boolean = false | ||
| ) extends RDD[InternalRow](sc, Nil) { | ||
| import GpuDataSourceRDD.GpuDataSourceRDDPartition | ||
|
|
||
|
|
@@ -60,12 +64,21 @@ class GpuDataSourceRDD( | |
| private var currentIter: Option[Iterator[Object]] = None | ||
| private var currentIndex: Int = 0 | ||
|
|
||
| override def hasNext: Boolean = { | ||
| override def hasNext: Boolean = try { | ||
| val result = currentIter.exists(_.hasNext) || advanceToNextIter() | ||
| if (!result) { | ||
| bytesReadTracker.update() | ||
| } | ||
| result | ||
| } catch { | ||
| case e: FileNotFoundException => | ||
| throw GpuDataSourceRDD.withRecoveryHint(e, includeRefreshHint) | ||
| case e: ExecutionException => | ||
| e.getCause match { | ||
| case cause: FileNotFoundException => | ||
| throw GpuDataSourceRDD.withRecoveryHint(cause, includeRefreshHint) | ||
| case _ => throw e | ||
| } | ||
| } | ||
|
|
||
| override def next(): Object = { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
|
|
@@ -74,6 +87,15 @@ class GpuDataSourceRDD( | |
| throw new NoSuchElementException("No more elements") | ||
| } | ||
| currentIter.get.next() | ||
| } catch { | ||
| case e: FileNotFoundException => | ||
| throw GpuDataSourceRDD.withRecoveryHint(e, includeRefreshHint) | ||
| case e: ExecutionException => | ||
| e.getCause match { | ||
| case cause: FileNotFoundException => | ||
| throw GpuDataSourceRDD.withRecoveryHint(cause, includeRefreshHint) | ||
| case _ => throw e | ||
| } | ||
| } finally { | ||
| bytesReadTracker.update() | ||
| } | ||
|
|
@@ -112,14 +134,43 @@ class GpuDataSourceRDD( | |
| } | ||
|
|
||
| object GpuDataSourceRDD { | ||
| private val RECREATE_HINT = "recreating the Dataset/DataFrame involved" | ||
| private val REFRESH_HINT = "REFRESH TABLE" | ||
|
|
||
| private def withRecoveryHint( | ||
| e: FileNotFoundException, | ||
| includeRefreshHint: Boolean): FileNotFoundException = { | ||
| val message = Option(e.getMessage).getOrElse(e.toString) | ||
| if (message.contains(RECREATE_HINT) && | ||
| (!includeRefreshHint || message.contains(REFRESH_HINT))) { | ||
| e | ||
| } else { | ||
| val recoveryHint = if (includeRefreshHint) { | ||
| "It is possible the underlying files have been updated. " + | ||
| "You can explicitly invalidate the cache in Spark by " + | ||
| "running 'REFRESH TABLE tableName' command in SQL or " + | ||
| "by recreating the Dataset/DataFrame involved." | ||
| } else { | ||
| "It is possible the underlying files have been updated. " + | ||
| "You can explicitly invalidate the cache in Spark by " + | ||
| "recreating the Dataset/DataFrame involved." | ||
| } | ||
| val enrichedException = new FileNotFoundException(s"$message\n$recoveryHint") | ||
|
thirtiseven marked this conversation as resolved.
Outdated
|
||
| enrichedException.initCause(e) | ||
| enrichedException | ||
| } | ||
| } | ||
|
|
||
| private case class GpuDataSourceRDDPartition( | ||
| override val index: Int, | ||
| inputPartitions: Seq[InputPartition]) extends Partition | ||
|
|
||
| def apply( | ||
| sc: SparkContext, | ||
| inputPartitions: Seq[InputPartition], | ||
| partitionReaderFactory: PartitionReaderFactory): GpuDataSourceRDD = { | ||
| new GpuDataSourceRDD(sc, inputPartitions.map(Seq(_)), partitionReaderFactory) | ||
| partitionReaderFactory: PartitionReaderFactory, | ||
| includeRefreshHint: Boolean = false): GpuDataSourceRDD = { | ||
| new GpuDataSourceRDD( | ||
| sc, inputPartitions.map(Seq(_)), partitionReaderFactory, includeRefreshHint) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.