Skip to content

Deduplicate convertToColumnDataType between RelToPlanNodeConverter and PRelToPlanNodeConverter#18661

Open
yashmayya wants to merge 1 commit into
apache:masterfrom
yashmayya:dedupe-convert-column-data-type
Open

Deduplicate convertToColumnDataType between RelToPlanNodeConverter and PRelToPlanNodeConverter#18661
yashmayya wants to merge 1 commit into
apache:masterfrom
yashmayya:dedupe-convert-column-data-type

Conversation

@yashmayya
Copy link
Copy Markdown
Contributor

@yashmayya yashmayya commented Jun 3, 2026

Summary

pinot-query-planner carried two byte-for-byte identical copies of the SqlTypeName -> DataSchema.ColumnDataType mapping switch (and its private resolveDecimal helper):

  • org.apache.pinot.query.planner.logical.RelToPlanNodeConverter#convertToColumnDataType
  • org.apache.pinot.query.planner.physical.v2.PRelToPlanNodeConverter#convertToColumnDataType

This 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.convertToColumnDataType comment, and add a dedicated PRelToPlanNodeConverterTest whose 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 PRelToPlanNodeConverter already imports from the logical package, so there is no module-boundary reason for the parallel implementation.

Change

PRelToPlanNodeConverter.toDataSchema now delegates directly to RelToPlanNodeConverter.convertToColumnDataType, mirroring how PinotEvaluateLiteralRule (and RexExpressionUtils, and pinot-broker's EmptyResponseUtils) already call it. The duplicated convertToColumnDataType / resolveDecimal methods — which had no external callers — are removed, along with the imports and LOGGER field that only they used. RelToPlanNodeConverter.convertToColumnDataType is 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 by RelToPlanNodeConverterTest, 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

  • Full pinot-query-planner test suite passes (1261/1261), including RelToPlanNodeConverterTest (full unsigned-type matrix), WorkerManagerTest (which drives the v2 physical-planner path through PRelToPlanNodeConverter), QueryCompilationTest (exercises the unsigned arms end-to-end through planning), and the ResourceBasedQueryPlansTest plan snapshots (no plan-output drift).
  • spotless, checkstyle, and license checks pass.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.48%. Comparing base (9717ba6) to head (bdb95e9).

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     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.48% <100.00%> (+<0.01%) ⬆️
temurin 64.48% <100.00%> (+<0.01%) ⬆️
unittests 64.48% <100.00%> (+<0.01%) ⬆️
unittests1 56.90% <100.00%> (+0.01%) ⬆️
unittests2 37.12% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yashmayya yashmayya force-pushed the dedupe-convert-column-data-type branch from 14fff1d to bdb95e9 Compare June 5, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants