Skip to content

branch-4.2 [feat](nereids) add table alias for catalog relation - #68213

Open
englefly wants to merge 2 commits into
apache:branch-4.2from
englefly:pick-56802-4.2
Open

englefly wants to merge 2 commits into
apache:branch-4.2from
englefly:pick-56802-4.2

Conversation

@englefly

Copy link
Copy Markdown
Contributor

Cherry-pick of #56802 to branch-4.2

feat add table alias for catalog relation

The alias is threaded through branch-4.2's constructors, which carry extra
parameters that master does not have (cachedSlots / relationSchema /
relationSnapshot / partitionPrunablePredicates / scoreLimit / scoreRangeInfo /
annOrderKeys / annLimit); those are preserved and tableAlias is appended last.
PhysicalOlapScan keeps branch-4.2's PhysicalOlapScan[<id>] table=... title and adds
alias=... as upstream does.

Expected-output baselines: the plan strings now contain alias=...; the shape_check
tpcds/tpch suites touched by this PR were verified against the branch-4.2 cluster and
the few that still lacked the alias were regenerated with -forceGenOut.

Tests: RewriteTopDownJobTest passes; shape_check tpcds_sf100 (112 suites),
tpcds_sf1000 (53), tpcds_sf10t_orc (26), tpch_sf1000 (14) and 14 nereids_rules_p0
suites + query_p0/join pass with 0 failures.

…he#56802)

### What problem does this PR solve?

This change extends the `tableAlias` feature from the logical plan layer
to the physical plan layer, enabling table aliases to be preserved
throughout the entire query execution pipeline from SQL parsing to
physical execution.

When analyzing query execution plans, especially for complex queries
where the same table appears multiple times with different aliases, it
has been challenging to match scan nodes in the plan back to their
corresponding table references in the original SQL.
…utputs

The 3-way merge of the upstream updated baselines missed the alias for a few
suites; regenerate them from the actual output of branch-4.2 + apache#56802.
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@englefly
englefly requested a review from yiguolei as a code owner September 18, 2026 16:59
@englefly

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 42.65% (58/136) 🎉
Increment coverage report
Complete coverage report

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