[refactor](fe) Extract toThrift from descriptor classes into DescriptorToThriftConverter#62312
[refactor](fe) Extract toThrift from descriptor classes into DescriptorToThriftConverter#62312924060929 merged 2 commits intoapache:masterfrom
Conversation
…orToThriftConverter ### What problem does this PR solve? Issue Number: close #xxx Problem Summary: The toThrift() methods on SlotDescriptor, TupleDescriptor, and DescriptorTable mix serialization logic with domain model classes. Following the same pattern as FunctionToThriftConverter, this PR extracts all three toThrift() methods into a new DescriptorToThriftConverter utility class, keeping the domain classes focused on their core responsibilities. ### Release note None ### Check List (For Author) - Test: Unit Test (DescriptorToThriftConverterTest with 17 test cases) - Behavior changed: No - Does this need documentation: No Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
run buildall |
|
/review |
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
There was a problem hiding this comment.
1 finding:
fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java:getTupleDescs()is a new public accessor that returns the livetupleDescs.values()view. External callers can mutate it viaremove()/clear()without updatingslotDescsor the id generators, which can leaveDescriptorTableinternally inconsistent. Because the new converter lives in the same package, this helper should stay package-private or return an unmodifiable view.
Critical checkpoint conclusions:
- Goal of task: Partially accomplished. The Thrift conversion logic was extracted and the visible call sites were migrated, but the refactor introduced the encapsulation regression above.
- Small, clear, focused change: Not fully. The refactor widens
DescriptorTable's public API unnecessarily. - Concurrency: Not applicable for the touched code; no new thread-safety issues were introduced.
- Lifecycle/static initialization: No special lifecycle or static initialization issues found.
- Configuration: No configuration changes.
- Compatibility/incompatible change: No FE-BE protocol or storage compatibility change found.
- Functionally parallel code paths: The call sites changed in this PR were updated consistently.
- Special conditional checks: No new risky conditional logic was introduced.
- Test coverage: Added unit tests cover the main Thrift conversion paths, but they do not protect against the new mutable API exposure.
- Observability: Not applicable.
- Transaction/persistence: Not applicable.
- Data writes/modifications: Not applicable.
- FE-BE variable passing: Not applicable.
- Performance: No material performance regression found in the converter logic.
- Other issues: No additional concrete correctness issues found beyond the public mutable accessor.
| result.addToTableDescriptors(tbl.toThrift()); | ||
| } | ||
| thriftDescTable = result; | ||
| return result; |
There was a problem hiding this comment.
getTupleDescs() exposes a live tupleDescs.values() view as public API. That collection supports remove()/clear(), so external callers can now mutate DescriptorTable without updating slotDescs or the ID generators, leaving the object internally inconsistent. Since DescriptorToThriftConverter is in the same package, this helper can stay package-private, or it should at least return an unmodifiable view.
FE UT Coverage ReportIncrement line coverage |
… path types with Java equivalents ### What problem does this PR solve? Issue Number: close #xxx Related PR: apache#62312 Problem Summary: 1. Remove TDescriptorTable cache from DescriptorTable - the thriftDescTable field, getThriftDescTable(), and setThriftDescTable() are removed. DescriptorToThriftConverter now always regenerates the Thrift representation. 2. Create Java equivalent classes (ColumnAccessPath, ColumnAccessPathType) to replace Thrift types (TColumnAccessPath, TAccessPathType, TDataAccessPath, TMetaAccessPath) used directly in domain code. The Thrift types are now confined to DescriptorToThriftConverter, which handles the conversion. DataAccessPath and MetaAccessPath are merged into a single ColumnAccessPath class since both are structurally identical (List<String> path). Type discrimination is via the ColumnAccessPathType enum (DATA, META). ### Release note None ### Check List (For Author) - Test: Unit Test (DescriptorToThriftConverterTest - 22 tests) - Behavior changed: No - Does this need documentation: No Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
run buildall |
|
/review |
|
No issues found in this review. Critical checkpoints:
Residual risk: |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
…orToThriftConverter (apache#62312) Problem Summary: The `toThrift()` methods on `SlotDescriptor`, `TupleDescriptor`, and `DescriptorTable` mix serialization logic with domain model classes. Following the same pattern as `FunctionToThriftConverter`, this PR extracts all three `toThrift()` methods into a new `DescriptorToThriftConverter` utility class, keeping the domain classes focused on their core responsibilities. **Changes:** - Created `DescriptorToThriftConverter` as a `final` utility class with private constructor and 3 static `toThrift` overloads - Created `DescriptorToThriftConverterTest` with 17 unit tests covering all code paths - Updated all 11 call sites across 7 files to use `DescriptorToThriftConverter.toThrift()` - Removed `toThrift()` from `SlotDescriptor`, `TupleDescriptor`, and `DescriptorTable` - Added necessary getters: `getMaterializedColumnName()`, `getThriftDescTable()`, `getTupleDescs()` - Cleaned up unused imports (`TSlotDescriptor`, `TTupleDescriptor`, `TableIf`, `Logger/LogManager`)
What problem does this PR solve?
Problem Summary:
The
toThrift()methods onSlotDescriptor,TupleDescriptor, andDescriptorTablemix serialization logic with domain model classes. Following the same pattern asFunctionToThriftConverter, this PR extracts all threetoThrift()methods into a newDescriptorToThriftConverterutility class, keeping the domain classes focused on their core responsibilities.Changes:
DescriptorToThriftConverteras afinalutility class with private constructor and 3 statictoThriftoverloadsDescriptorToThriftConverterTestwith 17 unit tests covering all code pathsDescriptorToThriftConverter.toThrift()toThrift()fromSlotDescriptor,TupleDescriptor, andDescriptorTablegetMaterializedColumnName(),getThriftDescTable(),getTupleDescs()TSlotDescriptor,TTupleDescriptor,TableIf,Logger/LogManager)Release note
None
Check List (For Author)