-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-26460 Refactor: Cleaning up usage of QueryConfig #1875
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
Conversation
|
Copyright Validation Results ✅ Valid Files
✅ All files have valid copyright headers! |
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 refactors the QueryConfig class from a mutable inner class to an immutable record, improving code clarity and maintainability. The refactoring consolidates multiple constructor parameters into a single QueryConfig object.
Key changes:
- Converted
QueryConfigfrom an inner class with public fields to a top-level immutable record - Simplified
QueryBatcherImplconstructor by accepting a singleQueryConfigparameter instead of 6 individual parameters - Restructured the
initConfigmethod to constructQueryConfigusing local variables before instantiation
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| QueryConfig.java | New record definition with 6 fields replacing the previous inner class |
| QueryBatcherImpl.java | Updated constructor to accept QueryConfig object and extract values from it |
| DataMovementServices.java | Refactored initConfig to build QueryConfig record; removed inner class definition |
| DataMovementManagerImpl.java | Updated to pass QueryConfig object to QueryBatcherImpl constructor; removed unused import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.queryMethod = "POST"; | ||
| this.query = queryMgr.newRawCtsQueryDefinition(new StringHandle(serializedCtsQuery).withFormat(Format.JSON)); | ||
| this.originalQuery = originalQuery; | ||
| this.filtered = queryConfig.filtered(); |
Copilot
AI
Jan 5, 2026
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 filtered field is being assigned the value from queryConfig.filtered() which can be null (Boolean object), but the previous code had a null check. If filtered is null, this could cause unexpected behavior. Consider preserving the null check: if (queryConfig.filtered() != null) { this.filtered = queryConfig.filtered(); }
| this.filtered = queryConfig.filtered(); | |
| if (queryConfig.filtered() != null) { | |
| this.filtered = queryConfig.filtered(); | |
| } |
Made QueryConfig into a record so it's immutable, making it easier to understand. And passing it to the constructor of QueryBatcherImpl instead of having 6 separate args.
2460b7a to
831ecdc
Compare
Made QueryConfig into a record so it's immutable, making it easier to understand. And passing it to the constructor of QueryBatcherImpl instead of having 6 separate args.