Skip to content

Commit

Permalink
Fix orca test
Browse files Browse the repository at this point in the history
  • Loading branch information
oppenheimer01 committed Jan 3, 2024
1 parent 265ea6b commit f592d04
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
8 changes: 8 additions & 0 deletions src/backend/gpopt/translate/CTranslatorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,9 @@ CTranslatorUtils::GetSystemColName(AttrNumber attno)
case GpSegmentIdAttributeNumber:
return CDXLTokens::GetDXLTokenStr(EdxltokenGpSegmentIdColName);

case GpForeignServerAttributeNumber:
return CDXLTokens::GetDXLTokenStr(EdxltokenGpForeignServerColName);

default:
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiPlStmt2DXLConversion,
GPOS_WSZ_LIT("Invalid attribute number"));
Expand Down Expand Up @@ -830,6 +833,10 @@ CTranslatorUtils::GetSystemColType(CMemoryPool *mp, AttrNumber attno)
// int4
return GPOS_NEW(mp) CMDIdGPDB(GPDB_INT4);

case GpForeignServerAttributeNumber:
// int4
return GPOS_NEW(mp) CMDIdGPDB(GPDB_INT4);

default:
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiPlStmt2DXLConversion,
GPOS_WSZ_LIT("Invalid attribute number"));
Expand Down Expand Up @@ -863,6 +870,7 @@ CTranslatorUtils::GetSystemColLength(AttrNumber attno)
// cid type

case GpSegmentIdAttributeNumber:
case GpForeignServerAttributeNumber:
// int4
return 4;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ enum Edxltoken
EdxltokenCmaxColName,
EdxltokenTableOidColName,
EdxltokenGpSegmentIdColName,
EdxltokenGpForeignServerColName,

EdxltokenActionColId,
EdxltokenOidColId,
Expand Down
1 change: 1 addition & 0 deletions src/backend/gporca/libnaucrates/src/xml/dxltokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ CDXLTokens::Init(CMemoryPool *mp)
{EdxltokenCmaxColName, GPOS_WSZ_LIT("cmax")},
{EdxltokenTableOidColName, GPOS_WSZ_LIT("tableoid")},
{EdxltokenGpSegmentIdColName, GPOS_WSZ_LIT("gp_segment_id")},
{EdxltokenGpForeignServerColName, GPOS_WSZ_LIT("gp_foreign_server")},

{EdxltokenActionColId, GPOS_WSZ_LIT("ActionCol")},
{EdxltokenOidColId, GPOS_WSZ_LIT("OidCol")},
Expand Down
16 changes: 8 additions & 8 deletions src/test/regress/expected/gporca_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -12621,7 +12621,7 @@ where out.b in (select coalesce(tcorr2.a, 99)
from tcorr1 left outer join tcorr2 on tcorr1.a=tcorr2.a+out.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------
Result (cost=0.00..1356692026.74 rows=1 width=8)
Result (cost=0.00..1356692031.36 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
Expand Down Expand Up @@ -12655,7 +12655,7 @@ where out.b in (select max(tcorr2.b + out.b - 1)
where tcorr2.a=out.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Result (cost=0.00..1324032.62 rows=1 width=8)
Result (cost=0.00..1324032.63 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
Expand Down Expand Up @@ -12690,12 +12690,12 @@ where out.b in (select coalesce(tcorr2_d.c, 99)
group by a) tcorr2_d on tcorr1.a=tcorr2_d.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Result (cost=0.00..1356692176.26 rows=1 width=8)
Result (cost=0.00..1356692180.88 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
SubPlan 1
-> Nested Loop Left Join (cost=0.00..1324032.70 rows=3 width=8)
-> Nested Loop Left Join (cost=0.00..1324032.71 rows=3 width=8)
Join Filter: (tcorr1_1.a = tcorr2.a)
-> Materialize (cost=0.00..431.00 rows=1 width=4)
-> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..431.00 rows=1 width=4)
Expand Down Expand Up @@ -12745,7 +12745,7 @@ where out.b in (select coalesce(tcorr2.a, 99)
from tcorr1 left outer join tcorr2 on tcorr1.a=tcorr2.a+out.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------
Result (cost=0.00..1356692026.74 rows=1 width=8)
Result (cost=0.00..1356692031.36 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
Expand Down Expand Up @@ -12779,7 +12779,7 @@ where out.b in (select max(tcorr2.b + out.b - 1)
where tcorr2.a=out.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Result (cost=0.00..1324032.62 rows=1 width=8)
Result (cost=0.00..1324032.63 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
Expand Down Expand Up @@ -12814,12 +12814,12 @@ where out.b in (select coalesce(tcorr2_d.c, 99)
group by a) tcorr2_d on tcorr1.a=tcorr2_d.a);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Result (cost=0.00..1356692176.26 rows=1 width=8)
Result (cost=0.00..1356692180.88 rows=1 width=8)
Filter: (SubPlan 1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=8)
-> Seq Scan on tcorr1 (cost=0.00..431.00 rows=1 width=8)
SubPlan 1
-> Nested Loop Left Join (cost=0.00..1324032.70 rows=3 width=8)
-> Nested Loop Left Join (cost=0.00..1324032.71 rows=3 width=8)
Join Filter: (tcorr1_1.a = tcorr2.a)
-> Materialize (cost=0.00..431.00 rows=1 width=4)
-> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..431.00 rows=1 width=4)
Expand Down
4 changes: 2 additions & 2 deletions src/test/regress/expected/tsrf_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ SELECT unnest(ARRAY[1, 2]) FROM few WHERE false;
ProjectSet
Output: unnest('{1,2}'::integer[])
-> Result
Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer
Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::integer
One-Time Filter: false
Optimizer: Pivotal Optimizer (GPORCA)
(6 rows)
Expand Down Expand Up @@ -120,7 +120,7 @@ SELECT * FROM few f1,
-> ProjectSet
Output: unnest('{1,2}'::integer[])
-> Result
Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer
Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::integer
One-Time Filter: false
Optimizer: Pivotal Optimizer (GPORCA)
(15 rows)
Expand Down
6 changes: 3 additions & 3 deletions src/test/regress/expected/uao_catalog_tables.out
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ select * from gp_toolkit.__gp_aovisimap_hidden_info('uao_table_check_hidden_tup_
-------+-----------------+----------------
1 | 0 | 0
2 | 0 | 0
1 | 0 | 0
1 | 0 | 1
2 | 0 | 0
1 | 0 | 0
1 | 0 | 5
2 | 0 | 0
(6 rows)

Expand Down Expand Up @@ -334,7 +334,7 @@ select * from gp_toolkit.__gp_aovisimap_hidden_info('uao_table_check_hidden_tup_
2 | 0 | 5
1 | 0 | 0
2 | 0 | 4
1 | 0 | 0
1 | 0 | 8
2 | 0 | 1
(6 rows)

4 changes: 2 additions & 2 deletions src/test/regress/expected/update_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ insert into utrtest values (1, 'foo')

insert into utrtest values (2, 'bar')
returning *, tableoid::regclass, xmin = pg_current_xact_id()::xid as xmin_ok; -- fails
ERROR: virtual tuple table slot does not have system attributes (execTuples.c:156)
ERROR: virtual tuple table slot does not have system attributes (execTuples.c:163) (seg0 slice1 127.0.1.1:7002 pid=1613506) (execTuples.c:163)
insert into utrtest values (2, 'bar')
returning *, tableoid::regclass;
a | b | tableoid
Expand All @@ -875,7 +875,7 @@ update utrtest set b = b || b from (values (1), (2)) s(x) where a = s.x

update utrtest set a = 3 - a from (values (1), (2)) s(x) where a = s.x
returning *, tableoid::regclass, xmin = pg_current_xact_id()::xid as xmin_ok; -- fails
ERROR: virtual tuple table slot does not have system attributes (execTuples.c:156)
ERROR: virtual tuple table slot does not have system attributes (execTuples.c:163) (seg0 slice1 127.0.1.1:7002 pid=1613506) (execTuples.c:163)
update utrtest set a = 3 - a from (values (1), (2)) s(x) where a = s.x
returning *, tableoid::regclass;
a | b | x | tableoid
Expand Down

0 comments on commit f592d04

Please sign in to comment.