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

ComparePerformance: fix crash in RTJO mode #3923

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

d10c
Copy link
Contributor

@d10c d10c commented Feb 11, 2025

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.

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.
@Copilot Copilot bot review requested due to automatic review settings February 11, 2025 12:23
@d10c d10c requested a review from a team as a code owner February 11, 2025 12:23

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

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

LGTM and I wrote the affected code; though someone with merge rights will need to approve

@d10c d10c merged commit 70cc4ed into github:main Feb 11, 2025
16 checks passed
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.

3 participants