Skip to content

Commit 2d15dd4

Browse files
fix enable_parallel
1 parent 725ff7b commit 2d15dd4

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

src/backend/gporca/libgpopt/include/gpopt/xforms/CXformImplementParallelSequence.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,8 @@ class CXformImplementParallelSequence : public CXformImplementation
6969
return "CXformImplementParallelSequence";
7070
}
7171

72-
// compute xform promise for a given expression handle
73-
EXformPromise
74-
Exfp(CExpressionHandle & // exprhdl
75-
) const override
76-
{
77-
return CXform::ExfpHigh;
78-
}
72+
// compute xform promise for a given expresion handle
73+
EXformPromise Exfp(CExpressionHandle &exprhdl) const override;
7974

8075
// actual transform
8176
void Transform(CXformContext *pxfctxt, CXformResult *pxfres,

src/backend/gporca/libgpopt/src/xforms/CXformImplementParallelCTEConsumer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#include "gpopt/operators/CPhysicalParallelCTEConsumer.h"
3535

3636
using namespace gpopt;
37+
namespace gpdb {
38+
bool IsParallelModeOK(void);
39+
}
3740

3841

3942
//---------------------------------------------------------------------------
@@ -63,6 +66,12 @@ CXform::EXformPromise
6366
CXformImplementParallelCTEConsumer::Exfp(CExpressionHandle & // exprhdl
6467
) const
6568
{
69+
// Check if parallel plans are enabled in context and parallel processing in safe
70+
if (!gpdb::IsParallelModeOK())
71+
{
72+
return CXform::ExfpNone;
73+
}
74+
6675
return CXform::ExfpHigh;
6776
}
6877

src/backend/gporca/libgpopt/src/xforms/CXformImplementParallelCTEProducer.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
#include "gpopt/operators/CPhysicalParallelCTEProducer.h"
3535

3636
using namespace gpopt;
37-
37+
namespace gpdb {
38+
bool IsParallelModeOK(void);
39+
}
3840

3941
//---------------------------------------------------------------------------
4042
// @function:
@@ -65,6 +67,12 @@ CXform::EXformPromise
6567
CXformImplementParallelCTEProducer::Exfp(CExpressionHandle & // exprhdl
6668
) const
6769
{
70+
// Check if parallel plans are enabled in context and parallel processing in safe
71+
if (!gpdb::IsParallelModeOK())
72+
{
73+
return CXform::ExfpNone;
74+
}
75+
6876
return CXform::ExfpHigh;
6977
}
7078

src/backend/gporca/libgpopt/src/xforms/CXformImplementParallelSequence.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include "gpopt/operators/CPhysicalParallelSequence.h"
3636

3737
using namespace gpopt;
38+
namespace gpdb {
39+
bool IsParallelModeOK(void);
40+
}
3841

3942

4043
//---------------------------------------------------------------------------
@@ -55,6 +58,27 @@ CXformImplementParallelSequence::CXformImplementParallelSequence(CMemoryPool *mp
5558
}
5659

5760

61+
//---------------------------------------------------------------------------
62+
// @function:
63+
// CXformImplementParallelCTEProducer::Exfp
64+
//
65+
// @doc:
66+
// Compute promise of xform
67+
//
68+
//---------------------------------------------------------------------------
69+
CXform::EXformPromise
70+
CXformImplementParallelSequence::Exfp(CExpressionHandle & // exprhdl
71+
) const
72+
{
73+
// Check if parallel plans are enabled in context and parallel processing in safe
74+
if (!gpdb::IsParallelModeOK())
75+
{
76+
return CXform::ExfpNone;
77+
}
78+
79+
return CXform::ExfpHigh;
80+
}
81+
5882
//---------------------------------------------------------------------------
5983
// @function:
6084
// CXformImplementParallelSequence::Transform

0 commit comments

Comments
 (0)