提交 e99325cc 编写于 作者: B Bhuvnesh Chaudhary and Haisheng Yuan 提交者: Jesse Zhang and Omer Arap

Don't replace filter child when the correlated outer is sequence while...

Don't replace filter child when the correlated outer is sequence while translating expr to dxl [#128520573]

When the outer child of correlated nest loop join is a partition table,
and it has predicate on the partition key, Orca generated plan with
dynamic partition selector and scan for the outer child, however while
translating plan expression to DXL ORCA always assumed that the outer child
is a relation instead of physical sequence, which caused Orca to replace
the partition selector with filter.

Here is an example to reproduce the issue:
```
create table t2(c int, d int);
create table h(j int, i int) DISTRIBUTED BY (i) PARTITION by RANGE(j) (START (1) END (3) EVERY (1));
select (select h.i from t2) from h where h.j = 1;
```
This issue has been fixed in this patch and relevant tests are added.
上级 151a6388
此差异已折叠。
......@@ -3449,10 +3449,19 @@ CTranslatorExprToDXL::PdxlnResultFromNLJoinOuter
// create a result node from the input expression
CDXLNode *pdxlnResult = PdxlnResult(pexprRelational, pdrgpcr, pdrgpdsBaseTables, pulNonGatherMotions, pfDML, pdxlprop);
// add the new filter to the result replacing its original
// empty filter
CDXLNode *pdxlnFilter = PdxlnFilter(pdxlnCond);
pdxlnResult->ReplaceChild(EdxltsIndexFilter /*ulPos*/, pdxlnFilter);
// In case the OuterChild is a physical sequence, it will already have the filter in the partition selector and
// dynamic scan, thus we should not replace the filter.
if(EdxlopPhysicalSequence != pdxlnResult->Pdxlop()->Edxlop())
{
// add the new filter to the result replacing its original
// empty filter
CDXLNode *pdxlnFilter = PdxlnFilter(pdxlnCond);
pdxlnResult->ReplaceChild(EdxltsIndexFilter /*ulPos*/, pdxlnFilter);
}
else
{
pdxlnCond->Release();
}
return pdxlnResult;
}
......
......@@ -28,6 +28,7 @@ ULONG CPartTblTest::m_ulPartTblTestCounter = 0; // start from first test
// minidump files
const CHAR *rgszPartTblFileNames[] =
{
"../data/dxl/minidump/PartTbl-DPE-Correlated-NLOuter.mdp",
"../data/dxl/minidump/Select-Over-PartTbl.mdp",
"../data/dxl/minidump/PartTbl-DPE.mdp",
"../data/dxl/minidump/PartTbl-DPE-WindowFunction.mdp",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册