fix: unify DeployStrategy empty-array errors to NoSuchElementException#5029
Merged
Conversation
Contributor
Author
|
/request-review @Yicong-Huang |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5029 +/- ##
============================================
- Coverage 43.19% 43.05% -0.14%
- Complexity 2209 2212 +3
============================================
Files 1045 1045
Lines 40265 40187 -78
Branches 4251 4241 -10
============================================
- Hits 17391 17304 -87
- Misses 21803 21815 +12
+ Partials 1071 1068 -3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# Conflicts: # amber/src/test/scala/org/apache/texera/amber/engine/architecture/deploysemantics/deploystrategy/DeployStrategiesSpec.scala
Contributor
Author
|
@Yicong-Huang please review |
Contributor
Author
|
@Yicong-Huang please review when you have time |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this PR?
OneOnEach,RoundRobinDeployment, andRandomDeploymenteach leaked a different implementation-detail exception whennext()was called on an emptyavailablearray (IndexOutOfBoundsException,ArithmeticException,and
IllegalArgumentExceptionrespectively), so callers had no single contract to handle. Eachnext()now guardsavailable.isEmptyand throwsNoSuchElementException("no available addresses"), the standard Scala/Javacontract for "no element to return". For
OneOnEach, the post-iteration "exhausted" branch was also switched toNoSuchElementException, so both empty-init and exhausted paths agree.Any related issues, documentation, or discussions?
Closes: #4732
How was this PR tested?
DeployStrategiesSpec(previously asserting the divergent exception types) to assertNoSuchElementExceptionfor:OneOnEachempty-init,OneOnEachexhausted-after-iteration,OneOnEachcursor-preserved-across-reinit,RoundRobinDeploymentempty, andRandomDeploymentempty.sbt scalafmtAllno formatting changes to the modified files.sbt testOnlyfor the spec could not run due to a pre-existing build.sbt load error (AddMetaInfLicenseFiles not found), unrelated to this change; CI is expected to run the spec.Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.7 in compliance with ASF