Skip to content

Commit 05d9edf

Browse files
yjhjstzmy-ship-it
authored andcommitted
clean code
revert CDistributionSpecRandom.cpp
1 parent d25108f commit 05d9edf

File tree

4 files changed

+10
-37
lines changed

4 files changed

+10
-37
lines changed

src/backend/gpopt/gpdbwrappers.cpp

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,7 +2732,6 @@ gpdb::IsParallelModeOK(void)
27322732
{
27332733
GP_WRAP_START;
27342734
{
2735-
// Basic GUC checks similar to PostgreSQL planner
27362735
if (!enable_parallel)
27372736
return false;
27382737

@@ -2742,37 +2741,21 @@ gpdb::IsParallelModeOK(void)
27422741
if (max_parallel_workers_per_gather <= 0)
27432742
return false;
27442743

2745-
// Check if we're in a parallel worker
2746-
if (!IsParallelPlansEnabled())
2747-
return false;
2748-
2749-
return true;
2750-
}
2751-
GP_WRAP_END;
2752-
return false;
2753-
}
2754-
2755-
bool
2756-
gpdb::IsParallelPlansEnabled(void)
2757-
{
2758-
GP_WRAP_START;
2759-
{
2760-
// Get from current optimizer context
2744+
// Check if parallel plans are enabled in current optimizer context
27612745
gpopt::COptCtxt *poctxt = gpopt::COptCtxt::PoctxtFromTLS();
27622746
if (nullptr != poctxt)
27632747
{
27642748
gpopt::COptimizerConfig *optimizer_config = poctxt->GetOptimizerConfig();
27652749
if (nullptr != optimizer_config)
27662750
{
2767-
return optimizer_config->CreateParallelPlan();
2751+
if (!optimizer_config->CreateParallelPlan())
2752+
return false;
27682753
}
27692754
}
2770-
return false; // default to disabled if no context
2755+
return true;
27712756
}
27722757
GP_WRAP_END;
2773-
return false;
2758+
return false; // default to disabled if no context
27742759
}
27752760

2776-
2777-
27782761
// EOF

src/backend/gporca/libgpdbcost/src/CCostModelGPDB.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ using namespace gpdbcost;
4747

4848
// Forward declare PostgreSQL GUC variables
4949
extern double parallel_setup_cost;
50-
extern double parallel_tuple_cost;
5150

5251
//---------------------------------------------------------------------------
5352
// @function:

src/backend/gporca/libgpopt/src/base/CDistributionSpecRandom.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ CDistributionSpecRandom::CDistributionSpecRandom(CColRef *gp_segment_id_)
5454
}
5555
}
5656

57-
5857
//---------------------------------------------------------------------------
5958
// @function:
6059
// CDistributionSpecRandom::Matches
@@ -117,15 +116,11 @@ CDistributionSpecRandom::FSatisfies(const CDistributionSpec *pds) const
117116
return true;
118117
}
119118

120-
// Regular segment-level satisfaction logic
121-
if (EdtRandom == pds->Edt())
119+
if (EdtRandom == pds->Edt() &&
120+
(IsDuplicateSensitive() ||
121+
!CDistributionSpecRandom::PdsConvert(pds)->IsDuplicateSensitive()))
122122
{
123-
const CDistributionSpecRandom *pdsRandom = CDistributionSpecRandom::PdsConvert(pds);
124-
125-
if (IsDuplicateSensitive() || !pdsRandom->IsDuplicateSensitive())
126-
{
127-
return true;
128-
}
123+
return true;
129124
}
130125

131126
return EdtAny == pds->Edt() || EdtNonSingleton == pds->Edt() ||
@@ -232,8 +227,7 @@ CDistributionSpecRandom::AppendEnforcers(CMemoryPool *mp,
232227
IOstream &
233228
CDistributionSpecRandom::OsPrint(IOstream &os) const
234229
{
235-
os << this->SzId();
236-
return os;
230+
return os << this->SzId();
237231
}
238232

239233
// EOF

src/include/gpopt/gpdbwrappers.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,6 @@ Oid GetBaseType(Oid typid);
720720
// check if parallel mode is OK (comprehensive check)
721721
bool IsParallelModeOK(void);
722722

723-
// check if parallel plans are enabled in current context
724-
bool IsParallelPlansEnabled(void);
725-
726723
// returns the result of evaluating 'expr' as an Expr. Caller keeps ownership of 'expr'
727724
// and takes ownership of the result
728725
Expr *EvaluateExpr(Expr *expr, Oid result_type, int32 typmod);

0 commit comments

Comments
 (0)