Skip to content
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

[Spark] Fix NoSuchElementException in DeltaHistoryManager parallel search with empty commits #3972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sumeet-db
Copy link
Collaborator

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

When performing time travel operations that trigger parallel search in DeltaHistoryManager (when searching through >2000 commits), a NoSuchElementException can occur if some partitions return empty commit lists. This happens because the code attempts to call .head on potentially empty collections without proper checks.

How was this patch tested?

UTs

Does this PR introduce any user-facing changes?

No

@@ -211,6 +211,9 @@ class DeltaHistoryManager(
start,
Some(end),
deltaLog.newDeltaHadoopConf())
if (commits.isEmpty) {
throw DeltaErrors.noHistoryFound(deltaLog.logPath)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right exception to throw here when [start, end) don't cover the entire history? All the other changes look good though.

@sumeet-db sumeet-db force-pushed the fix_time_travel_exception branch from 17b686d to e56a4e7 Compare December 16, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants