-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Minor code cleanup #26037
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
Minor code cleanup #26037
Conversation
DynamicFilterService does not need to depend on SqlQueryExecution and this makes the code less readable.
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.
Pull Request Overview
This PR decouples DynamicFilterService from SqlQueryExecution and ensures that once a query’s final info is set, subsequent updates return the existing info.
- Change
registerQuerysignature to acceptSessionandPlanNodeinstead ofSqlQueryExecution - Update
SqlQueryExecutionto call the newregisterQueryoverload - Modify
QueryStateMachine.updateQueryInfoto reuse an already-set finalQueryInfo
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/trino-main/src/main/java/io/trino/server/DynamicFilterService.java | Removed dependency on SqlQueryExecution and updated method signature for registerQuery |
| core/trino-main/src/main/java/io/trino/execution/SqlQueryExecution.java | Updated call to dynamicFilterService.registerQuery with new parameters |
| core/trino-main/src/main/java/io/trino/execution/QueryStateMachine.java | Enhanced updateQueryInfo to return existing final info if already set |
Comments suppressed due to low confidence (1)
core/trino-main/src/main/java/io/trino/execution/QueryStateMachine.java:1390
- Consider adding a unit test to verify that updateQueryInfo returns the existing final QueryInfo when finalQueryInfo is already set to prevent regressions in this new behavior.
if (!finalQueryInfo.compareAndSet(Optional.empty(), Optional.of(queryInfo))) {
| } | ||
|
|
||
| dynamicFilterService.registerQuery(this, plan.getRoot()); | ||
| dynamicFilterService.registerQuery(getSession(), getQueryPlan().orElseThrow().getRoot(), plan.getRoot()); |
Copilot
AI
Jun 19, 2025
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.
[nitpick] Extract getQueryPlan().orElseThrow().getRoot() into a local variable to avoid repeated Optional unwrapping in the method call for clarity and potential reuse.
| dynamicFilterService.registerQuery(getSession(), getQueryPlan().orElseThrow().getRoot(), plan.getRoot()); | |
| var queryPlanRoot = getQueryPlan().orElseThrow().getRoot(); | |
| dynamicFilterService.registerQuery(getSession(), queryPlanRoot, plan.getRoot()); |
Description
Release notes
(X) This is not user-visible or is docs only, and no release notes are required.