ComparePerformance: fix crash in RTJO mode#3923
Merged
d10c merged 1 commit intogithub:mainfrom Feb 11, 2025
Merged
Conversation
With `--dynamic-join-order-mode=all`, both `first` and `second` are undefined, leading to a crash. Until RTJO mode gets proper tuple counting, this change prevents a crash when unfurling the steps of a predicate.
Contributor
There was a problem hiding this comment.
PR Overview
This PR addresses a crash in RTJO mode by ensuring that when both "first" and "second" are undefined, the code safely defaults to an empty array instead of attempting to access a property on an undefined object. Key changes include updating the default for steps in the predicate row component to prevent a crash.
- Replace non-null assertion on "second" with safe optional chaining.
- Provide an empty array as fallback to ensure safe iteration with map.
Changes
| File | Description |
|---|---|
| extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx | Updated the steps extraction to safely handle undefined values and prevent a crash in RTJO mode |
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx:801
- Ensure that using an empty array as the default value for steps covers all expected cases, and consider adding an inline comment to explain why the empty array fallback is necessary to prevent crashes when both 'first' and 'second' are undefined.
{abbreviateRASteps(first?.steps ?? second?.steps ?? []).map(
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
asgerf
reviewed
Feb 11, 2025
koesie10
approved these changes
Feb 11, 2025
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.
With
--dynamic-join-order-mode=all, bothfirstandsecondareundefined, leading to a crash. Until RTJO mode gets proper tuple
counting, this change prevents a crash when unfurling the steps of a
predicate.