This is an automated email from the ASF dual-hosted git repository. maxyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit c4ab9b387234450b40eed83721aa5c4a6ff0c69d Author: David Kimura <[email protected]> AuthorDate: Fri Oct 27 09:46:09 2023 -0700 [ORCA] Allow alias name to represent table name (#16659) Access to alias name will be necessary when hints reference the same relation multiple times in a query (e.g. self-join). It provides a way to distinguish each reference to the relation. --- contrib/file_fdw/output/gp_file_fdw_optimizer.source | 2 +- src/backend/gpopt/translate/CTranslatorUtils.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/contrib/file_fdw/output/gp_file_fdw_optimizer.source b/contrib/file_fdw/output/gp_file_fdw_optimizer.source index 7fb035d0fb..715f735bfb 100644 --- a/contrib/file_fdw/output/gp_file_fdw_optimizer.source +++ b/contrib/file_fdw/output/gp_file_fdw_optimizer.source @@ -128,7 +128,7 @@ explain select word1 from text_csv_coordinator ft1, bar where ft1.word1 = bar.a Hash Cond: (word1 = bar.a) -> Redistribute Motion 1:3 (slice2) (cost=0.00..431.00 rows=1 width=8) Hash Key: word1 - -> Foreign Scan on text_csv_coordinator (cost=0.00..431.00 rows=1 width=8) + -> Foreign Scan on text_csv_coordinator ft1 (cost=0.00..431.00 rows=1 width=8) Foreign File: @abs_srcdir@/file_fdw/data/text.csv Foreign File Size: 86 b -> Hash (cost=431.00..431.00 rows=1 width=4) diff --git a/src/backend/gpopt/translate/CTranslatorUtils.cpp b/src/backend/gpopt/translate/CTranslatorUtils.cpp index c0782d0787..904c455844 100644 --- a/src/backend/gpopt/translate/CTranslatorUtils.cpp +++ b/src/backend/gpopt/translate/CTranslatorUtils.cpp @@ -124,10 +124,12 @@ CTranslatorUtils::GetTableDescr(CMemoryPool *mp, CMDAccessor *md_accessor, CMDIdGPDB *mdid = GPOS_NEW(mp) CMDIdGPDB(IMDId::EmdidRel, rel_oid); const IMDRelation *rel = md_accessor->RetrieveRel(mdid); - // look up table name - const CWStringConst *tablename = rel->Mdname().GetMDName(); - CMDName *table_mdname = GPOS_NEW(mp) CMDName(mp, tablename); + CMDName *table_mdname = + rte->alias + ? GPOS_NEW(mp) CMDName( + GPOS_NEW(mp) CWStringConst(mp, rte->alias->aliasname), true) + : GPOS_NEW(mp) CMDName(mp, rel->Mdname().GetMDName()); ULONG required_perms = static_cast<ULONG>(rte->requiredPerms); CDXLTableDescr *table_descr = GPOS_NEW(mp) CDXLTableDescr( --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
