Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "gpopt/operators/CPredicateUtils.h"
#include "gpopt/operators/CScalarProjectList.h"

namespace gpdb
{
bool IsParallelModeOK(void);
}



using namespace gpopt;
Expand Down Expand Up @@ -63,6 +68,16 @@ CXformLeftSemiJoin2InnerJoin::CXformLeftSemiJoin2InnerJoin(CMemoryPool *mp)
CXform::EXformPromise
CXformLeftSemiJoin2InnerJoin::Exfp(CExpressionHandle &exprhdl) const
{
/*
* In parallel mode, prefer direct semi-join implementations. Rewriting a
* semi-join to an inner join plus dedup can produce unstable ORCA plans
* for parallel queries.
*/
if (gpdb::IsParallelModeOK())
{
return ExfpNone;
Comment thread
aviralgarg05 marked this conversation as resolved.
Outdated
}

if (exprhdl.HasOuterRefs() || exprhdl.DeriveHasSubquery(2))
{
return ExfpNone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "gpopt/operators/CPredicateUtils.h"
#include "gpopt/operators/CScalarProjectList.h"

namespace gpdb
{
bool IsParallelModeOK(void);
}

using namespace gpopt;

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -60,6 +65,16 @@ CXformLeftSemiJoin2InnerJoinUnderGb::CXformLeftSemiJoin2InnerJoinUnderGb(
CXform::EXformPromise
CXformLeftSemiJoin2InnerJoinUnderGb::Exfp(CExpressionHandle &exprhdl) const
{
/*
* In parallel mode, prefer direct semi-join implementations. Rewriting a
* semi-join to an inner join plus dedup can produce unstable ORCA plans
* for parallel queries.
*/
if (gpdb::IsParallelModeOK())
{
return ExfpNone;
}

CColRefSet *pcrsInnerOutput = exprhdl.DeriveOutputColumns(1);
CExpression *pexprScalar = exprhdl.PexprScalarExactChild(2);
CAutoMemoryPool amp;
Expand Down