satwik-codeium opened a new pull request, #17470: URL: https://github.com/apache/druid/pull/17470
### Description This PR updates the `SegmentLoadStatusFetcher` to use the new SQL package's `BrokerClient` implementation, replacing the deprecated discovery-based `BrokerClient`. This change improves code maintainability and aligns with Druid's ongoing modernization efforts. #### Migrated BrokerClient Implementation - Replaced deprecated `org.apache.druid.discovery.BrokerClient` with `org.apache.druid.sql.client.BrokerClient` - Updated SQL task handling to use proper task state management through `SqlTaskStatus` - Fixed locale-dependent string formatting by using `StringUtils.format` #### Updated Test Framework - Refactored `SegmentLoadStatusFetcherTest` to properly mock SQL task lifecycle - Added proper task state transitions (RUNNING → SUCCESS) in test cases - Maintained existing test coverage while adapting to new API #### Release note Migrated Multi-Stage Query's segment load status checking to use the new SQL package's BrokerClient, removing dependency on the deprecated discovery-based implementation. This change improves code maintainability and provides better SQL task state handling. <hr> ##### Key changed/added classes in this PR * `org.apache.druid.msq.exec.SegmentLoadStatusFetcher` * `org.apache.druid.msq.exec.SegmentLoadStatusFetcherTest` <hr> This PR has: - [x] been self-reviewed. - [x] added documentation for modified behaviors. - [x] a release note entry in the PR description. - [x] added comments explaining the "why" and intent of code changes. - [x] modified existing tests to cover new code paths. - [x] been tested through unit tests. Design Decisions: 1. Task State Management: - Switched to using `TaskState` for explicit state tracking - Simplified error handling by properly propagating task status - Improved readability by separating state management from query execution 2. Test Structure: - Mock responses now simulate realistic task state transitions - Maintained existing test scenarios while adapting to new API - Added proper verification of task state changes 3. Error Handling: - Improved error propagation through `SqlTaskStatus` - Added explicit handling of failed tasks - Enhanced logging for better debugging -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org