Deduplicate convertToColumnDataType between RelToPlanNodeConverter and PRelToPlanNodeConverter#18661
Open
yashmayya wants to merge 1 commit into
Open
Deduplicate convertToColumnDataType between RelToPlanNodeConverter and PRelToPlanNodeConverter#18661yashmayya wants to merge 1 commit into
yashmayya wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18661 +/- ##
=========================================
Coverage 64.47% 64.48%
Complexity 1291 1291
=========================================
Files 3372 3372
Lines 208584 208547 -37
Branches 32574 32551 -23
=========================================
- Hits 134494 134479 -15
+ Misses 63294 63280 -14
+ Partials 10796 10788 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…d PRelToPlanNodeConverter
14fff1d to
bdb95e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pinot-query-plannercarried two byte-for-byte identical copies of theSqlTypeName -> DataSchema.ColumnDataTypemapping switch (and its privateresolveDecimalhelper):org.apache.pinot.query.planner.logical.RelToPlanNodeConverter#convertToColumnDataTypeorg.apache.pinot.query.planner.physical.v2.PRelToPlanNodeConverter#convertToColumnDataTypeThis is a duplicated source of truth that risks the two type tables silently drifting apart. The recent Calcite 1.42 upgrade (#18658) is a concrete example: it had to add the new unsigned-integer-type handling (
UTINYINT/USMALLINT→ INT,UINTEGER→ LONG,UBIGINT→ reject) to both copies in lockstep, annotate the v2 copy with a// Kept in sync with RelToPlanNodeConverter.convertToColumnDataTypecomment, and add a dedicatedPRelToPlanNodeConverterTestwhose stated purpose was to "mirror the unsigned-type coverage ... so the two converters cannot silently drift out of sync."Both classes live in the same module and
PRelToPlanNodeConverteralready imports from thelogicalpackage, so there is no module-boundary reason for the parallel implementation.Change
PRelToPlanNodeConverter.toDataSchemanow delegates directly toRelToPlanNodeConverter.convertToColumnDataType, mirroring howPinotEvaluateLiteralRule(andRexExpressionUtils, andpinot-broker'sEmptyResponseUtils) already call it. The duplicatedconvertToColumnDataType/resolveDecimalmethods — which had no external callers — are removed, along with the imports andLOGGERfield that only they used.RelToPlanNodeConverter.convertToColumnDataTypeis now the single source of truth, so the two tables can no longer drift and the "keep in sync" maintenance burden is gone.The now-obsolete
PRelToPlanNodeConverterTest(the anti-drift mirror) is removed: with a single implementation there is nothing to mirror, and its unsigned-type cases are already covered byRelToPlanNodeConverterTest, which exercises the exact method the v2 converter now delegates to.This is a pure, behavior-preserving refactor: the removed method was identical to the delegation target.
Testing
pinot-query-plannertest suite passes (1261/1261), includingRelToPlanNodeConverterTest(full unsigned-type matrix),WorkerManagerTest(which drives the v2 physical-planner path throughPRelToPlanNodeConverter),QueryCompilationTest(exercises the unsigned arms end-to-end through planning), and theResourceBasedQueryPlansTestplan snapshots (no plan-output drift).spotless,checkstyle, andlicensechecks pass.