-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Enhancement] Add active planning queries to current_queries view #63094
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
base: main
Are you sure you want to change the base?
Conversation
|
@Mergifyio rebase |
✅ Branch has been successfully rebased |
4cd0496 to
4533a79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| } | ||
| } finally { | ||
| context.setPlanning(false); | ||
| QeProcessorImpl.INSTANCE.unMonitorQuery(context.getExecutionId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the queryId is taken from the context and removed in the finally block, queries are properly cleaned up, preventing the memory leak issues.
| .warehouseName(info.coord.getWarehouseName()) | ||
| .resourceGroupName(info.coord.getResourceGroupName()) | ||
| .execState(execState) | ||
| .build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Builder Misuse: Double .build() Invocation
The itemBuilder incorrectly calls .build() on line 193, discarding the result, and then calls .build() again on line 202. Builders are typically designed for a single .build() invocation, so calling it twice on the same instance can lead to runtime errors or incorrect results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| private ExecPlan generateExecPlan() throws Exception { | ||
| ExecPlan execPlan = null; | ||
| QeProcessorImpl.QueryInfo queryInfo = QeProcessorImpl.QueryInfo.fromPlanningQuery(context, originStmt.originStmt); | ||
| QeProcessorImpl.INSTANCE.registerQuery(context.getExecutionId(), queryInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Double Query Registration Causes Exception
The new code registers a query during planning in generateExecPlan. This causes a double registration issue because the same query is registered again during execution (e.g., in handleQueryStmt) using the same executionId. Since QeProcessorImpl.registerQuery uses putIfAbsent, this results in an AlreadyExistsException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query is registered and then removed within the generateExecPlan method. The registration during execution occurs in the subsequent step.
|
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
66c0288 to
6022db3
Compare
Why I'm doing:
For #62203.
What I'm doing:
This PR adds active planning queries to current_queries view.
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: