提交 2a38a9cd 编写于 作者: B Bhuvnesh Chaudhary 提交者: Bhuvnesh

Hungarian notation removal specific to GPOS and Naucrates libraries

As part of moving away from Hungarian notation in the GPORCA codebase,
the integration points between GPORCA and GPDB in the translator have
been renamed to the new convention used in GPORCA. The libraries
currently updated to the new notation in GPORCA are Naucrates and GPOS.
The new naming convention is a custom version of common C++ naming
conventions. The style guide for this convention can be found in the
GPORCA repository.

Also bump ORCA version to 2.69.0
Co-authored-by: NShreedhar Hardikar <shardikar@pivotal.io>
Co-authored-by: NMelanie Plageman <mplageman@pivotal.io>
Co-authored-by: NEkta Khanna <ekhanna@pivotal.io>
Co-authored-by: NAbhijit Subramanya <asubramanya@pivotal.io>
Co-authored-by: NSambitesh Dash <sdash@pivotal.io&gt;&lt;Paste>
Co-authored-by: NDhanashree Kashid <dkashid@pivotal.io>
Co-authored-by: NOmer Arap <oarap@pivotal.io>
上级 2371cb3b
......@@ -40,10 +40,10 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <string.h>
]],
[
return strncmp("2.68.", GPORCA_VERSION_STRING, 5);
return strncmp("2.69.", GPORCA_VERSION_STRING, 5);
])],
[AC_MSG_RESULT([[ok]])],
[AC_MSG_ERROR([Your ORCA version is expected to be 2.68.XXX])]
[AC_MSG_ERROR([Your ORCA version is expected to be 2.69.XXX])]
)
AC_LANG_POP([C++])
])# PGAC_CHECK_ORCA_VERSION
......
......@@ -13405,7 +13405,7 @@ int
main ()
{
return strncmp("2.68.", GPORCA_VERSION_STRING, 5);
return strncmp("2.69.", GPORCA_VERSION_STRING, 5);
;
return 0;
......@@ -13415,7 +13415,7 @@ if ac_fn_cxx_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
else
as_fn_error $? "Your ORCA version is expected to be 2.68.XXX" "$LINENO" 5
as_fn_error $? "Your ORCA version is expected to be 2.69.XXX" "$LINENO" 5
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
......
......@@ -276,7 +276,7 @@ static int translateQueryToFile
Assert(pquery);
char *szXmlString = COptTasks::SzDXL(pquery);
int iLen = (int) gpos::clib::UlStrLen(szXmlString);
int iLen = (int) gpos::clib::Strlen(szXmlString);
CFileWriter fw;
fw.Open(szFilename, S_IRUSR | S_IWUSR);
......@@ -668,14 +668,14 @@ DumpMDObjDXL(PG_FUNCTION_ARGS)
{
Oid oid = gpdb::OidFromDatum(PG_GETARG_DATUM(0));
char *szDXL = COptTasks::SzMDObjs(ListMake1Oid(oid));
char *dxl_string = COptTasks::SzMDObjs(ListMake1Oid(oid));
if (NULL == szDXL)
if (NULL == dxl_string)
{
elog(ERROR, "Error dumping MD object");
}
PG_RETURN_TEXT_P(cstring_to_text(szDXL));
PG_RETURN_TEXT_P(cstring_to_text(dxl_string));
}
}
......@@ -696,9 +696,9 @@ DumpRelStatsDXL(PG_FUNCTION_ARGS)
{
Oid oid = gpdb::OidFromDatum(PG_GETARG_DATUM(0));
char *szDXL = COptTasks::SzRelStats(ListMake1Oid(oid));
char *dxl_string = COptTasks::SzRelStats(ListMake1Oid(oid));
PG_RETURN_TEXT_P(cstring_to_text(szDXL));
PG_RETURN_TEXT_P(cstring_to_text(dxl_string));
}
}
......@@ -720,9 +720,9 @@ DumpMDCastDXL(PG_FUNCTION_ARGS)
Oid oidSrc = gpdb::OidFromDatum(PG_GETARG_DATUM(0));
Oid oidDest = gpdb::OidFromDatum(PG_GETARG_DATUM(1));
char *szDXL = COptTasks::SzMDCast(ListMake2Oid(oidSrc, oidDest));
char *dxl_string = COptTasks::SzMDCast(ListMake2Oid(oidSrc, oidDest));
PG_RETURN_TEXT_P(cstring_to_text(szDXL));
PG_RETURN_TEXT_P(cstring_to_text(dxl_string));
}
}
......@@ -745,9 +745,9 @@ DumpMDScCmpDXL(PG_FUNCTION_ARGS)
Oid oidRight = gpdb::OidFromDatum(PG_GETARG_DATUM(1));
char *szCmpType = text_to_cstring(PG_GETARG_TEXT_P(2));
char *szDXL = COptTasks::SzMDScCmp(ListMake2Oid(oidLeft, oidRight), szCmpType);
char *dxl_string = COptTasks::SzMDScCmp(ListMake2Oid(oidLeft, oidRight), szCmpType);
PG_RETURN_TEXT_P(cstring_to_text(szDXL));
PG_RETURN_TEXT_P(cstring_to_text(dxl_string));
}
}
......
[requires]
orca/v2.68.0@gpdb/stable
orca/v2.69.0@gpdb/stable
[imports]
include, * -> build/include
......
......@@ -121,7 +121,7 @@ sync_tools: opt_write_test /opt/releng/apache-ant
-Divyrepo.user=$(IVYREPO_USER) -Divyrepo.passwd="$(IVYREPO_PASSWD)" -quiet resolve);
ifeq "$(findstring aix,$(BLD_ARCH))" ""
LD_LIBRARY_PATH='' wget --no-check-certificate -q -O - https://github.com/greenplum-db/gporca/releases/download/v2.68.0/bin_orca_centos5_release.tar.gz | tar zxf - -C $(BLD_TOP)/ext/$(BLD_ARCH)
LD_LIBRARY_PATH='' wget --no-check-certificate -q -O - https://github.com/greenplum-db/gporca/releases/download/v2.69.0/bin_orca_centos5_release.tar.gz | tar zxf - -C $(BLD_TOP)/ext/$(BLD_ARCH)
endif
clean_tools: opt_write_test
......
Subproject commit b77e59f4f6c6fd68aa1ae64cfbda8ec86f15092c
Subproject commit 19a8896e9cb300f66e1f788d1989d1c0e10641e4
......@@ -40,7 +40,7 @@
#include "cdb/cdbgang.h"
#ifdef USE_ORCA
extern char *SzDXLPlan(Query *parse);
extern char *SerializeDXLPlan(Query *parse);
extern const char *OptVersion();
#endif
......@@ -335,7 +335,7 @@ ExplainDXL(Query *query, ExplainState *es, const char *queryString,
optimizer_enumerate_plans = true;
/* optimize query using optimizer and get generated plan in DXL format */
dxl = SzDXLPlan(query);
dxl = SerializeDXLPlan(query);
/* restore old value of enumerate plans GUC */
optimizer_enumerate_plans = save_enumerate;
......
......@@ -36,26 +36,26 @@ extern MemoryContext MessageContext;
//
//---------------------------------------------------------------------------
PlannedStmt *
CGPOptimizer::PplstmtOptimize
CGPOptimizer::GPOPTOptimizedPlan
(
Query *pquery,
bool *pfUnexpectedFailure // output : set to true if optimizer unexpectedly failed to produce plan
Query *query,
bool *had_unexpected_failure // output : set to true if optimizer unexpectedly failed to produce plan
)
{
SOptContext octx;
SOptContext gpopt_context;
PlannedStmt* plStmt = NULL;
GPOS_TRY
{
plStmt = COptTasks::PplstmtOptimize(pquery, &octx, pfUnexpectedFailure);
plStmt = COptTasks::GPOPTOptimizedPlan(query, &gpopt_context, had_unexpected_failure);
// clean up context
octx.Free(octx.epinQuery, octx.epinPlStmt);
gpopt_context.Free(gpopt_context.epinQuery, gpopt_context.epinPlStmt);
}
GPOS_CATCH_EX(ex)
{
// clone the error message before context free.
CHAR* szErrorMsg = octx.CloneErrorMsg(MessageContext);
CHAR* serialized_error_msg = gpopt_context.CloneErrorMsg(MessageContext);
// clean up context
octx.Free(octx.epinQuery, octx.epinPlStmt);
gpopt_context.Free(gpopt_context.epinQuery, gpopt_context.epinPlStmt);
// Special handler for a few common user-facing errors. In particular,
// we want to use the correct error code for these, in case an application
......@@ -64,18 +64,18 @@ CGPOptimizer::PplstmtOptimize
// application errors.
if (GPOS_MATCH_EX(ex, gpdxl::ExmaDXL, gpdxl::ExmiQuery2DXLNotNullViolation))
{
errstart(ERROR, ex.SzFilename(), ex.UlLine(), NULL, TEXTDOMAIN);
errstart(ERROR, ex.Filename(), ex.Line(), NULL, TEXTDOMAIN);
errfinish(errcode(ERRCODE_NOT_NULL_VIOLATION),
errmsg("%s", szErrorMsg));
errmsg("%s", serialized_error_msg));
}
else if (GPOS_MATCH_EX(ex, gpdxl::ExmaDXL, gpdxl::ExmiOptimizerError) ||
NULL != szErrorMsg)
NULL != serialized_error_msg)
{
Assert(NULL != szErrorMsg);
errstart(ERROR, ex.SzFilename(), ex.UlLine(), NULL, TEXTDOMAIN);
Assert(NULL != serialized_error_msg);
errstart(ERROR, ex.Filename(), ex.Line(), NULL, TEXTDOMAIN);
errfinish(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("%s", szErrorMsg));
errmsg("%s", serialized_error_msg));
}
else if (GPOS_MATCH_EX(ex, gpdxl::ExmaGPDB, gpdxl::ExmiGPDBError))
{
......@@ -83,13 +83,13 @@ CGPOptimizer::PplstmtOptimize
}
else if (GPOS_MATCH_EX(ex, gpdxl::ExmaDXL, gpdxl::ExmiNoAvailableMemory))
{
errstart(ERROR, ex.SzFilename(), ex.UlLine(), NULL, TEXTDOMAIN);
errstart(ERROR, ex.Filename(), ex.Line(), NULL, TEXTDOMAIN);
errfinish(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("No available memory to allocate string buffer."));
}
else if (GPOS_MATCH_EX(ex, gpdxl::ExmaDXL, gpdxl::ExmiInvalidComparisonTypeCode))
{
errstart(ERROR, ex.SzFilename(), ex.UlLine(), NULL, TEXTDOMAIN);
errstart(ERROR, ex.Filename(), ex.Line(), NULL, TEXTDOMAIN);
errfinish(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("Invalid comparison type code. Valid values are Eq, NEq, LT, LEq, GT, GEq."));
}
......@@ -108,18 +108,18 @@ CGPOptimizer::PplstmtOptimize
//
//---------------------------------------------------------------------------
char *
CGPOptimizer::SzDXLPlan
CGPOptimizer::SerializeDXLPlan
(
Query *pquery
Query *query
)
{
GPOS_TRY;
{
return COptTasks::SzOptimize(pquery);
return COptTasks::Optimize(query);
}
GPOS_CATCH_EX(ex);
{
errstart(ERROR, ex.SzFilename(), ex.UlLine(), NULL, TEXTDOMAIN);
errstart(ERROR, ex.Filename(), ex.Line(), NULL, TEXTDOMAIN);
errfinish(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("Optimizer failed to produce plan"));
}
......@@ -147,7 +147,7 @@ CGPOptimizer::InitGPOPT ()
gpos_free = gpdb::OptimizerFree;
}
struct gpos_init_params params =
{gpos_alloc, gpos_free, gpdb::FAbortRequested};
{gpos_alloc, gpos_free, gpdb::IsAbortRequested};
gpos_init(&params);
gpdxl_init();
gpopt_init();
......@@ -171,7 +171,7 @@ CGPOptimizer::TerminateGPOPT ()
//---------------------------------------------------------------------------
// @function:
// PplstmtOptimize
// GPOPTOptimizedPlan
//
// @doc:
// Expose GP optimizer API to C files
......@@ -179,19 +179,19 @@ CGPOptimizer::TerminateGPOPT ()
//---------------------------------------------------------------------------
extern "C"
{
PlannedStmt *PplstmtOptimize
PlannedStmt *GPOPTOptimizedPlan
(
Query *pquery,
bool *pfUnexpectedFailure
Query *query,
bool *had_unexpected_failure
)
{
return CGPOptimizer::PplstmtOptimize(pquery, pfUnexpectedFailure);
return CGPOptimizer::GPOPTOptimizedPlan(query, had_unexpected_failure);
}
}
//---------------------------------------------------------------------------
// @function:
// SzDXLPlan
// SerializeDXLPlan
//
// @doc:
// Serialize planned statement to DXL
......@@ -199,12 +199,12 @@ PlannedStmt *PplstmtOptimize
//---------------------------------------------------------------------------
extern "C"
{
char *SzDXLPlan
char *SerializeDXLPlan
(
Query *pquery
Query *query
)
{
return CGPOptimizer::SzDXLPlan(pquery);
return CGPOptimizer::SerializeDXLPlan(query);
}
}
......
......@@ -25,89 +25,89 @@ using namespace gpdxl;
using namespace gpopt;
// array mapping GUCs to traceflags
CConfigParamMapping::SConfigMappingElem CConfigParamMapping::m_elem[] =
CConfigParamMapping::SConfigMappingElem CConfigParamMapping::m_elements[] =
{
{
EopttracePrintQuery,
&optimizer_print_query,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints the optimizer's input query expression tree.")
},
{
EopttracePrintPlan,
&optimizer_print_plan,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints the plan expression tree produced by the optimizer.")
},
{
EopttracePrintXform,
&optimizer_print_xform,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints the input and output expression trees of the optimizer transformations.")
},
{
EopttracePrintXformResults,
&optimizer_print_xform_results,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Print input and output of xforms.")
},
{
EopttracePrintMemoAfterExploration,
&optimizer_print_memo_after_exploration,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints MEMO after exploration.")
},
{
EopttracePrintMemoAfterImplementation,
&optimizer_print_memo_after_implementation,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints MEMO after implementation.")
},
{
EopttracePrintMemoAfterOptimization,
&optimizer_print_memo_after_optimization,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints MEMO after optimization.")
},
{
EopttracePrintJobScheduler,
&optimizer_print_job_scheduler,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints jobs in scheduler on each job completion.")
},
{
EopttracePrintExpressionProperties,
&optimizer_print_expression_properties,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints expression properties.")
},
{
EopttracePrintGroupProperties,
&optimizer_print_group_properties,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints group properties.")
},
{
EopttracePrintOptimizationContext,
&optimizer_print_optimization_context,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints optimization context.")
},
{
EopttracePrintOptimizationStatistics,
&optimizer_print_optimization_stats,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Prints optimization stats.")
},
......@@ -116,397 +116,397 @@ CConfigParamMapping::SConfigMappingElem CConfigParamMapping::m_elem[] =
// GPDB_91_MERGE_FIXME: I turned optimizer_minidump from bool into
// an enum-type GUC. It's a bit dirty to cast it like this..
(bool *) &optimizer_minidump,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Generate optimizer minidump.")
},
{
EopttraceDisableMotions,
&optimizer_enable_motions,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable motion nodes in optimizer.")
},
{
EopttraceDisableMotionBroadcast,
&optimizer_enable_motion_broadcast,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable motion broadcast nodes in optimizer.")
},
{
EopttraceDisableMotionGather,
&optimizer_enable_motion_gather,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable motion gather nodes in optimizer.")
},
{
EopttraceDisableMotionHashDistribute,
&optimizer_enable_motion_redistribute,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable motion hash-distribute nodes in optimizer.")
},
{
EopttraceDisableMotionRandom,
&optimizer_enable_motion_redistribute,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable motion random nodes in optimizer.")
},
{
EopttraceDisableMotionRountedDistribute,
&optimizer_enable_motion_redistribute,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable motion routed-distribute nodes in optimizer.")
},
{
EopttraceDisableSort,
&optimizer_enable_sort,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable sort nodes in optimizer.")
},
{
EopttraceDisableSpool,
&optimizer_enable_materialize,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable spool nodes in optimizer.")
},
{
EopttraceDisablePartPropagation,
&optimizer_enable_partition_propagation,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable partition propagation nodes in optimizer.")
},
{
EopttraceDisablePartSelection,
&optimizer_enable_partition_selection,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable partition selection in optimizer.")
},
{
EopttraceDisableOuterJoin2InnerJoinRewrite,
&optimizer_enable_outerjoin_rewrite,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable outer join to inner join rewrite in optimizer.")
},
{
EopttraceDonotDeriveStatsForAllGroups,
&optimizer_enable_derive_stats_all_groups,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Disable deriving stats for all groups after exploration.")
},
{
EopttraceEnableSpacePruning,
&optimizer_enable_space_pruning,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable space pruning in optimizer.")
},
{
EopttraceForceMultiStageAgg,
&optimizer_force_multistage_agg,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Force optimizer to always pick multistage aggregates when such a plan alternative is generated.")
},
{
EopttracePrintColsWithMissingStats,
&optimizer_print_missing_stats,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Print columns with missing statistics.")
},
{
EopttraceEnableRedistributeBroadcastHashJoin,
&optimizer_enable_hashjoin_redistribute_broadcast_children,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable generating hash join plan where outer child is Redistribute and inner child is Broadcast.")
},
{
EopttraceExtractDXLStats,
&optimizer_extract_dxl_stats,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Extract plan stats in dxl.")
},
{
EopttraceExtractDXLStatsAllNodes,
&optimizer_extract_dxl_stats_all_nodes,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Extract plan stats for all physical dxl nodes.")
},
{
EopttraceDeriveStatsForDPE,
&optimizer_dpe_stats,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable stats derivation of partitioned tables with dynamic partition elimination.")
},
{
EopttraceEnumeratePlans,
&optimizer_enumerate_plans,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable plan enumeration.")
},
{
EopttraceSamplePlans,
&optimizer_sample_plans,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable plan sampling.")
},
{
EopttraceEnableCTEInlining,
&optimizer_cte_inlining,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable CTE inlining.")
},
{
EopttraceEnableConstantExpressionEvaluation,
&optimizer_enable_constant_expression_evaluation,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable constant expression evaluation in the optimizer")
},
{
EopttraceUseExternalConstantExpressionEvaluationForInts,
&optimizer_use_external_constant_expression_evaluation_for_ints,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable constant expression evaluation for integers in the optimizer")
},
{
EopttraceApplyLeftOuter2InnerUnionAllLeftAntiSemiJoinDisregardingStats,
&optimizer_apply_left_outer_to_union_all_disregarding_stats,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Always apply Left Outer Join to Inner Join UnionAll Left Anti Semi Join without looking at stats")
},
{
EopttraceRemoveOrderBelowDML,
&optimizer_remove_order_below_dml,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Remove OrderBy below a DML operation")
},
{
EopttraceDisableReplicateInnerNLJOuterChild,
&optimizer_enable_broadcast_nestloop_outer_child,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Enable plan alternatives where NLJ's outer child is replicated")
},
{
EopttraceEnforceCorrelatedExecution,
&optimizer_enforce_subplans,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enforce correlated execution in the optimizer")
},
{
EopttraceForceExpandedMDQAs,
&optimizer_force_expanded_distinct_aggs,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Always pick plans that expand multiple distinct aggregates into join of single distinct aggregate in the optimizer")
},
{
EopttraceDisablePushingCTEConsumerReqsToCTEProducer,
&optimizer_push_requirements_from_consumer_to_producer,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Optimize CTE producer plan on requirements enforced on top of CTE consumer")
},
{
EopttraceDisablePruneUnusedComputedColumns,
&optimizer_prune_computed_columns,
true, // m_fNegate
true, // m_negate_param
GPOS_WSZ_LIT("Prune unused computed columns when pre-processing query")
},
{
EopttraceForceThreeStageScalarDQA,
&optimizer_force_three_stage_scalar_dqa,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Force optimizer to always pick 3 stage aggregate plan for scalar distinct qualified aggregate.")
},
{
EopttraceEnableParallelAppend,
&optimizer_parallel_union,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Enable parallel execution for UNION/UNION ALL queries.")
},
{
EopttraceArrayConstraints,
&optimizer_array_constraints,
false, // m_fNegate
false, // m_negate_param
GPOS_WSZ_LIT("Allows the constraint framework to derive array constraints in the optimizer.")
}
};
//---------------------------------------------------------------------------
// @function:
// CConfigParamMapping::PbsPack
// CConfigParamMapping::PackConfigParamInBitset
//
// @doc:
// Pack the GPDB config params into a bitset
//
//---------------------------------------------------------------------------
CBitSet *
CConfigParamMapping::PbsPack
CConfigParamMapping::PackConfigParamInBitset
(
IMemoryPool *pmp,
ULONG ulXforms // number of available xforms
IMemoryPool *mp,
ULONG xform_id // number of available xforms
)
{
CBitSet *pbs = GPOS_NEW(pmp) CBitSet(pmp, EopttraceSentinel);
CBitSet *traceflag_bitset = GPOS_NEW(mp) CBitSet(mp, EopttraceSentinel);
for (ULONG ul = 0; ul < GPOS_ARRAY_SIZE(m_elem); ul++)
for (ULONG ul = 0; ul < GPOS_ARRAY_SIZE(m_elements); ul++)
{
SConfigMappingElem elem = m_elem[ul];
GPOS_ASSERT(!pbs->FBit((ULONG) elem.m_etf) &&
SConfigMappingElem elem = m_elements[ul];
GPOS_ASSERT(!traceflag_bitset->Get((ULONG) elem.m_trace_flag) &&
"trace flag already set");
BOOL fVal = *elem.m_pfParam;
if (elem.m_fNegate)
BOOL value = *elem.m_is_param;
if (elem.m_negate_param)
{
// negate the value of config param
fVal = !fVal;
value = !value;
}
if (fVal)
if (value)
{
#ifdef GPOS_DEBUG
BOOL fSet =
BOOL is_traceflag_set =
#endif // GPOS_DEBUG
pbs->FExchangeSet((ULONG) elem.m_etf);
GPOS_ASSERT(!fSet);
traceflag_bitset->ExchangeSet((ULONG) elem.m_trace_flag);
GPOS_ASSERT(!is_traceflag_set);
}
}
// pack disable flags of xforms
for (ULONG ul = 0; ul < ulXforms; ul++)
for (ULONG ul = 0; ul < xform_id; ul++)
{
GPOS_ASSERT(!pbs->FBit(EopttraceDisableXformBase + ul) &&
GPOS_ASSERT(!traceflag_bitset->Get(EopttraceDisableXformBase + ul) &&
"xform trace flag already set");
if (optimizer_xforms[ul])
{
#ifdef GPOS_DEBUG
BOOL fSet =
BOOL is_traceflag_set =
#endif // GPOS_DEBUG
pbs->FExchangeSet(EopttraceDisableXformBase + ul);
GPOS_ASSERT(!fSet);
traceflag_bitset->ExchangeSet(EopttraceDisableXformBase + ul);
GPOS_ASSERT(!is_traceflag_set);
}
}
if (!optimizer_enable_indexjoin)
{
CBitSet *pbsIndexJoin = CXform::PbsIndexJoinXforms(pmp);
pbs->Union(pbsIndexJoin);
pbsIndexJoin->Release();
CBitSet *index_join_bitset = CXform::PbsIndexJoinXforms(mp);
traceflag_bitset->Union(index_join_bitset);
index_join_bitset->Release();
}
// disable bitmap scan if the corresponding GUC is turned off
if (!optimizer_enable_bitmapscan)
{
CBitSet *pbsBitmapScan = CXform::PbsBitmapIndexXforms(pmp);
pbs->Union(pbsBitmapScan);
pbsBitmapScan->Release();
CBitSet *bitmap_index_bitset = CXform::PbsBitmapIndexXforms(mp);
traceflag_bitset->Union(bitmap_index_bitset);
bitmap_index_bitset->Release();
}
// disable outerjoin to unionall transformation if GUC is turned off
if (!optimizer_enable_outerjoin_to_unionall_rewrite)
{
pbs->FExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfLeftOuter2InnerUnionAllLeftAntiSemiJoin));
traceflag_bitset->ExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfLeftOuter2InnerUnionAllLeftAntiSemiJoin));
}
// disable Assert MaxOneRow plans if GUC is turned off
if (!optimizer_enable_assert_maxonerow)
{
pbs->FExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfMaxOneRow2Assert));
traceflag_bitset->ExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfMaxOneRow2Assert));
}
if (!optimizer_enable_partial_index)
{
CBitSet *pbsHeterogeneousIndex = CXform::PbsHeterogeneousIndexXforms(pmp);
pbs->Union(pbsHeterogeneousIndex);
pbsHeterogeneousIndex->Release();
CBitSet *heterogeneous_index_bitset = CXform::PbsHeterogeneousIndexXforms(mp);
traceflag_bitset->Union(heterogeneous_index_bitset);
heterogeneous_index_bitset->Release();
}
if (!optimizer_enable_hashjoin)
{
// disable hash-join if the corresponding GUC is turned off
CBitSet *pbsHashJoin = CXform::PbsHashJoinXforms(pmp);
pbs->Union(pbsHashJoin);
pbsHashJoin->Release();
CBitSet *hash_join_bitste = CXform::PbsHashJoinXforms(mp);
traceflag_bitset->Union(hash_join_bitste);
hash_join_bitste->Release();
}
if (!optimizer_enable_dynamictablescan)
{
// disable dynamic table scan if the corresponding GUC is turned off
pbs->FExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfDynamicGet2DynamicTableScan));
traceflag_bitset->ExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfDynamicGet2DynamicTableScan));
}
if (!optimizer_enable_tablescan)
{
// disable table scan if the corresponding GUC is turned off
pbs->FExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfGet2TableScan));
traceflag_bitset->ExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfGet2TableScan));
}
if (!optimizer_enable_indexscan)
{
// disable index scan if the corresponding GUC is turned off
pbs->FExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfIndexGet2IndexScan));
traceflag_bitset->ExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfIndexGet2IndexScan));
}
CBitSet *pbsJoinHeuristic = NULL;
CBitSet *join_heuristic_bitset = NULL;
switch (optimizer_join_order)
{
case JOIN_ORDER_IN_QUERY:
pbsJoinHeuristic = CXform::PbsJoinOrderInQueryXforms(pmp);
join_heuristic_bitset = CXform::PbsJoinOrderInQueryXforms(mp);
break;
case JOIN_ORDER_GREEDY_SEARCH:
pbsJoinHeuristic = CXform::PbsJoinOrderOnGreedyXforms(pmp);
join_heuristic_bitset = CXform::PbsJoinOrderOnGreedyXforms(mp);
break;
case JOIN_ORDER_EXHAUSTIVE_SEARCH:
pbsJoinHeuristic = GPOS_NEW(pmp) CBitSet(pmp, EopttraceSentinel);
join_heuristic_bitset = GPOS_NEW(mp) CBitSet(mp, EopttraceSentinel);
break;
default:
elog(ERROR, "Invalid value for optimizer_join_order, must \
not come here");
break;
}
pbs->Union(pbsJoinHeuristic);
pbsJoinHeuristic->Release();
traceflag_bitset->Union(join_heuristic_bitset);
join_heuristic_bitset->Release();
// disable join associativity transform if the corresponding GUC
// is turned off independent of the join order algorithm chosen
if (!optimizer_enable_associativity)
{
pbs->FExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfJoinAssociativity));
traceflag_bitset->ExchangeSet(GPOPT_DISABLE_XFORM_TF(CXform::ExfJoinAssociativity));
}
// enable nested loop index plans using nest params
// instead of outer reference as in the case with GPDB 4/5
pbs->FExchangeSet(EopttraceIndexedNLJOuterRefAsParams);
traceflag_bitset->ExchangeSet(EopttraceIndexedNLJOuterRefAsParams);
return pbs;
return traceflag_bitset;
}
// EOF
此差异已折叠。
......@@ -37,41 +37,41 @@ using namespace gpmd;
//---------------------------------------------------------------------------
CMDProviderRelcache::CMDProviderRelcache
(
IMemoryPool *pmp
IMemoryPool *mp
)
:
m_pmp(pmp)
m_mp(mp)
{
GPOS_ASSERT(NULL != m_pmp);
GPOS_ASSERT(NULL != m_mp);
}
//---------------------------------------------------------------------------
// @function:
// CMDProviderRelcache::PstrObject
// CMDProviderRelcache::GetMDObjDXLStr
//
// @doc:
// Returns the DXL of the requested object in the provided memory pool
//
//---------------------------------------------------------------------------
CWStringBase *
CMDProviderRelcache::PstrObject
CMDProviderRelcache::GetMDObjDXLStr
(
IMemoryPool *pmp,
CMDAccessor *pmda,
IMDId *pmdid
IMemoryPool *mp,
CMDAccessor *md_accessor,
IMDId *md_id
)
const
{
IMDCacheObject *pimdobj = CTranslatorRelcacheToDXL::Pimdobj(pmp, pmda, pmdid);
IMDCacheObject *md_obj = CTranslatorRelcacheToDXL::RetrieveObject(mp, md_accessor, md_id);
GPOS_ASSERT(NULL != pimdobj);
GPOS_ASSERT(NULL != md_obj);
CWStringDynamic *pstr = CDXLUtils::PstrSerializeMDObj(m_pmp, pimdobj, true /*fSerializeHeaders*/, false /*findent*/);
CWStringDynamic *str = CDXLUtils::SerializeMDObj(m_mp, md_obj, true /*fSerializeHeaders*/, false /*findent*/);
// cleanup DXL object
pimdobj->Release();
md_obj->Release();
return pstr;
return str;
}
// EOF
......@@ -33,26 +33,26 @@ using namespace gpdxl;
//---------------------------------------------------------------------------
CCTEListEntry::CCTEListEntry
(
IMemoryPool *pmp,
ULONG ulQueryLevel,
CommonTableExpr *pcte,
CDXLNode *pdxlnCTEProducer
IMemoryPool *mp,
ULONG query_level,
CommonTableExpr *cte,
CDXLNode *cte_producer
)
:
m_ulQueryLevel(ulQueryLevel),
m_phmszcteinfo(NULL)
m_query_level(query_level),
m_cte_info(NULL)
{
GPOS_ASSERT(NULL != pcte && NULL != pdxlnCTEProducer);
GPOS_ASSERT(NULL != cte && NULL != cte_producer);
m_phmszcteinfo = GPOS_NEW(pmp) HMSzCTEInfo(pmp);
Query *pqueryCTE = (Query*) pcte->ctequery;
m_cte_info = GPOS_NEW(mp) HMSzCTEInfo(mp);
Query *cte_query = (Query*) cte->ctequery;
#ifdef GPOS_DEBUG
BOOL fResult =
BOOL result =
#endif
m_phmszcteinfo->FInsert(pcte->ctename, GPOS_NEW(pmp) SCTEProducerInfo(pdxlnCTEProducer, pqueryCTE->targetList));
m_cte_info->Insert(cte->ctename, GPOS_NEW(mp) SCTEProducerInfo(cte_producer, cte_query->targetList));
GPOS_ASSERT(fResult);
GPOS_ASSERT(result);
}
//---------------------------------------------------------------------------
......@@ -65,84 +65,84 @@ CCTEListEntry::CCTEListEntry
//---------------------------------------------------------------------------
CCTEListEntry::CCTEListEntry
(
IMemoryPool *pmp,
ULONG ulQueryLevel,
List *plCTE,
DrgPdxln *pdrgpdxln
IMemoryPool *mp,
ULONG query_level,
List *cte_list,
CDXLNodeArray *cte_dxl_arr
)
:
m_ulQueryLevel(ulQueryLevel),
m_phmszcteinfo(NULL)
m_query_level(query_level),
m_cte_info(NULL)
{
GPOS_ASSERT(NULL != pdrgpdxln);
GPOS_ASSERT(pdrgpdxln->UlLength() == gpdb::UlListLength(plCTE));
GPOS_ASSERT(NULL != cte_dxl_arr);
GPOS_ASSERT(cte_dxl_arr->Size() == gpdb::ListLength(cte_list));
m_phmszcteinfo = GPOS_NEW(pmp) HMSzCTEInfo(pmp);
const ULONG ulCTEs = pdrgpdxln->UlLength();
m_cte_info = GPOS_NEW(mp) HMSzCTEInfo(mp);
const ULONG num_cte = cte_dxl_arr->Size();
for (ULONG ul = 0; ul < ulCTEs; ul++)
for (ULONG ul = 0; ul < num_cte; ul++)
{
CDXLNode *pdxlnCTEProducer = (*pdrgpdxln)[ul];
CommonTableExpr *pcte = (CommonTableExpr*) gpdb::PvListNth(plCTE, ul);
CDXLNode *cte_producer = (*cte_dxl_arr)[ul];
CommonTableExpr *cte = (CommonTableExpr*) gpdb::ListNth(cte_list, ul);
Query *pqueryCTE = (Query*) pcte->ctequery;
Query *cte_query = (Query*) cte->ctequery;
#ifdef GPOS_DEBUG
BOOL fResult =
BOOL result =
#endif
m_phmszcteinfo->FInsert(pcte->ctename, GPOS_NEW(pmp) SCTEProducerInfo(pdxlnCTEProducer, pqueryCTE->targetList));
m_cte_info->Insert(cte->ctename, GPOS_NEW(mp) SCTEProducerInfo(cte_producer, cte_query->targetList));
GPOS_ASSERT(fResult);
GPOS_ASSERT(NULL != m_phmszcteinfo->PtLookup(pcte->ctename));
GPOS_ASSERT(result);
GPOS_ASSERT(NULL != m_cte_info->Find(cte->ctename));
}
}
//---------------------------------------------------------------------------
// @function:
// CCTEListEntry::PdxlnCTEProducer
// CCTEListEntry::GetCTEProducer
//
// @doc:
// Return the query of the CTE referenced in the range table entry
//
//---------------------------------------------------------------------------
const CDXLNode *
CCTEListEntry::PdxlnCTEProducer
CCTEListEntry::GetCTEProducer
(
const CHAR *szCTE
const CHAR *cte_str
)
const
{
SCTEProducerInfo *pcteinfo = m_phmszcteinfo->PtLookup(szCTE);
if (NULL == pcteinfo)
SCTEProducerInfo *cte_info = m_cte_info->Find(cte_str);
if (NULL == cte_info)
{
return NULL;
}
return pcteinfo->m_pdxlnCTEProducer;
return cte_info->m_cte_producer;
}
//---------------------------------------------------------------------------
// @function:
// CCTEListEntry::PdxlnCTEProducer
// CCTEListEntry::GetCTEProducerTargetList
//
// @doc:
// Return the query of the CTE referenced in the range table entry
// Return the target list of the CTE referenced in the range table entry
//
//---------------------------------------------------------------------------
List *
CCTEListEntry::PlCTEProducerTL
CCTEListEntry::GetCTEProducerTargetList
(
const CHAR *szCTE
const CHAR *cte_str
)
const
{
SCTEProducerInfo *pcteinfo = m_phmszcteinfo->PtLookup(szCTE);
if (NULL == pcteinfo)
SCTEProducerInfo *cte_info = m_cte_info->Find(cte_str);
if (NULL == cte_info)
{
return NULL;
}
return pcteinfo->m_plTargetList;
return cte_info->m_target_list;
}
//---------------------------------------------------------------------------
......@@ -156,20 +156,20 @@ CCTEListEntry::PlCTEProducerTL
void
CCTEListEntry::AddCTEProducer
(
IMemoryPool *pmp,
CommonTableExpr *pcte,
const CDXLNode *pdxlnCTEProducer
IMemoryPool *mp,
CommonTableExpr *cte,
const CDXLNode *cte_producer
)
{
GPOS_ASSERT(NULL == m_phmszcteinfo->PtLookup(pcte->ctename) && "CTE entry already exists");
Query *pqueryCTE = (Query*) pcte->ctequery;
GPOS_ASSERT(NULL == m_cte_info->Find(cte->ctename) && "CTE entry already exists");
Query *cte_query = (Query*) cte->ctequery;
#ifdef GPOS_DEBUG
BOOL fResult =
BOOL result =
#endif
m_phmszcteinfo->FInsert(pcte->ctename, GPOS_NEW(pmp) SCTEProducerInfo(pdxlnCTEProducer, pqueryCTE->targetList));
m_cte_info->Insert(cte->ctename, GPOS_NEW(mp) SCTEProducerInfo(cte_producer, cte_query->targetList));
GPOS_ASSERT(fResult);
GPOS_ASSERT(result);
}
// EOF
......@@ -35,28 +35,28 @@ using namespace gpdxl;
//---------------------------------------------------------------------------
CContextDXLToPlStmt::CContextDXLToPlStmt
(
IMemoryPool *pmp,
CIdGenerator *pidgtorPlan,
CIdGenerator *pidgtorMotion,
CIdGenerator *pidgtorParam,
List **plRTable,
List **plSubPlan
IMemoryPool *mp,
CIdGenerator *plan_id_counter,
CIdGenerator *motion_id_counter,
CIdGenerator *param_id_counter,
List **rtable_entries_list,
List **subplan_entries_list
)
:
m_pmp(pmp),
m_pidgtorPlan(pidgtorPlan),
m_pidgtorMotion(pidgtorMotion),
m_pidgtorParam(pidgtorParam),
m_pplRTable(plRTable),
m_plPartitionTables(NULL),
m_pdrgpulNumSelectors(NULL),
m_pplSubPlan(plSubPlan),
m_ulResultRelation(0),
m_pintocl(NULL),
m_pdistrpolicy(NULL)
m_mp(mp),
m_plan_id_counter(plan_id_counter),
m_motion_id_counter(motion_id_counter),
m_param_id_counter(param_id_counter),
m_rtable_entries_list(rtable_entries_list),
m_partitioned_tables_list(NULL),
m_num_partition_selectors_array(NULL),
m_subplan_entries_list(subplan_entries_list),
m_result_relation_index(0),
m_into_clause(NULL),
m_distribution_policy(NULL)
{
m_phmulcteconsumerinfo = GPOS_NEW(m_pmp) HMUlCTEConsumerInfo(m_pmp);
m_pdrgpulNumSelectors = GPOS_NEW(m_pmp) DrgPul(m_pmp);
m_cte_consumer_info = GPOS_NEW(m_mp) HMUlCTEConsumerInfo(m_mp);
m_num_partition_selectors_array = GPOS_NEW(m_mp) ULongPtrArray(m_mp);
}
//---------------------------------------------------------------------------
......@@ -69,78 +69,78 @@ CContextDXLToPlStmt::CContextDXLToPlStmt
//---------------------------------------------------------------------------
CContextDXLToPlStmt::~CContextDXLToPlStmt()
{
m_phmulcteconsumerinfo->Release();
m_pdrgpulNumSelectors->Release();
m_cte_consumer_info->Release();
m_num_partition_selectors_array->Release();
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::UlNextPlanId
// CContextDXLToPlStmt::GetNextPlanId
//
// @doc:
// Get the next plan id
//
//---------------------------------------------------------------------------
ULONG
CContextDXLToPlStmt::UlNextPlanId()
CContextDXLToPlStmt::GetNextPlanId()
{
return m_pidgtorPlan->UlNextId();
return m_plan_id_counter->next_id();
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::UlCurrentMotionId
// CContextDXLToPlStmt::GetCurrentMotionId
//
// @doc:
// Get the current motion id
//
//---------------------------------------------------------------------------
ULONG
CContextDXLToPlStmt::UlCurrentMotionId()
CContextDXLToPlStmt::GetCurrentMotionId()
{
return m_pidgtorMotion->UlCurrentId();
return m_motion_id_counter->current_id();
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::UlNextMotionId
// CContextDXLToPlStmt::GetNextMotionId
//
// @doc:
// Get the next motion id
//
//---------------------------------------------------------------------------
ULONG
CContextDXLToPlStmt::UlNextMotionId()
CContextDXLToPlStmt::GetNextMotionId()
{
return m_pidgtorMotion->UlNextId();
return m_motion_id_counter->next_id();
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::UlNextParamId
// CContextDXLToPlStmt::GetNextParamId
//
// @doc:
// Get the next plan id
//
//---------------------------------------------------------------------------
ULONG
CContextDXLToPlStmt::UlNextParamId()
CContextDXLToPlStmt::GetNextParamId()
{
return m_pidgtorParam->UlNextId();
return m_param_id_counter->next_id();
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::UlCurrentParamId
// CContextDXLToPlStmt::GetCurrentParamId
//
// @doc:
// Get the current param id
//
//---------------------------------------------------------------------------
ULONG
CContextDXLToPlStmt::UlCurrentParamId()
CContextDXLToPlStmt::GetCurrentParamId()
{
return m_pidgtorParam->UlCurrentId();
return m_param_id_counter->current_id();
}
//---------------------------------------------------------------------------
......@@ -154,49 +154,49 @@ CContextDXLToPlStmt::UlCurrentParamId()
void
CContextDXLToPlStmt::AddCTEConsumerInfo
(
ULONG ulCteId,
ShareInputScan *pshscan
ULONG cte_id,
ShareInputScan *share_input_scan
)
{
GPOS_ASSERT(NULL != pshscan);
GPOS_ASSERT(NULL != share_input_scan);
SCTEConsumerInfo *pcteinfo = m_phmulcteconsumerinfo->PtLookup(&ulCteId);
if (NULL != pcteinfo)
SCTEConsumerInfo *cte_info = m_cte_consumer_info->Find(&cte_id);
if (NULL != cte_info)
{
pcteinfo->AddCTEPlan(pshscan);
cte_info->AddCTEPlan(share_input_scan);
return;
}
List *plPlanCTE = ListMake1(pshscan);
List *cte_plan = ListMake1(share_input_scan);
ULONG *pulKey = GPOS_NEW(m_pmp) ULONG(ulCteId);
ULONG *key = GPOS_NEW(m_mp) ULONG(cte_id);
#ifdef GPOS_DEBUG
BOOL fResult =
BOOL result =
#endif
m_phmulcteconsumerinfo->FInsert(pulKey, GPOS_NEW(m_pmp) SCTEConsumerInfo(plPlanCTE));
m_cte_consumer_info->Insert(key, GPOS_NEW(m_mp) SCTEConsumerInfo(cte_plan));
GPOS_ASSERT(fResult);
GPOS_ASSERT(result);
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::PplanCTEProducer
// CContextDXLToPlStmt::GetCTEConsumerList
//
// @doc:
// Return the list of GPDB plan nodes representing the CTE consumers
// with the given CTE identifier
//---------------------------------------------------------------------------
List *
CContextDXLToPlStmt::PshscanCTEConsumer
CContextDXLToPlStmt::GetCTEConsumerList
(
ULONG ulCteId
ULONG cte_id
)
const
{
SCTEConsumerInfo *pcteinfo = m_phmulcteconsumerinfo->PtLookup(&ulCteId);
if (NULL != pcteinfo)
SCTEConsumerInfo *cte_info = m_cte_consumer_info->Find(&cte_id);
if (NULL != cte_info)
{
return pcteinfo->m_plSis;
return cte_info->m_cte_consumer_list;
}
return NULL;
......@@ -204,30 +204,30 @@ CContextDXLToPlStmt::PshscanCTEConsumer
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::PlPrte
// CContextDXLToPlStmt::GetRTableEntriesList
//
// @doc:
// Return the list of RangeTableEntries
//
//---------------------------------------------------------------------------
List *
CContextDXLToPlStmt::PlPrte()
CContextDXLToPlStmt::GetRTableEntriesList()
{
return (*(m_pplRTable));
return (*(m_rtable_entries_list));
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::PlPplanSubplan
// CContextDXLToPlStmt::GetSubplanEntriesList
//
// @doc:
// Return the list of subplans generated so far
//
//---------------------------------------------------------------------------
List *
CContextDXLToPlStmt::PlPplanSubplan()
CContextDXLToPlStmt::GetSubplanEntriesList()
{
return (*(m_pplSubPlan));
return (*(m_subplan_entries_list));
}
//---------------------------------------------------------------------------
......@@ -241,19 +241,19 @@ CContextDXLToPlStmt::PlPplanSubplan()
void
CContextDXLToPlStmt::AddRTE
(
RangeTblEntry *prte,
BOOL fResultRelation
RangeTblEntry *rte,
BOOL is_result_relation
)
{
(* (m_pplRTable)) = gpdb::PlAppendElement((*(m_pplRTable)), prte);
(* (m_rtable_entries_list)) = gpdb::LAppend((*(m_rtable_entries_list)), rte);
prte->inFromCl = true;
rte->inFromCl = true;
if (fResultRelation)
if (is_result_relation)
{
GPOS_ASSERT(0 == m_ulResultRelation && "Only one result relation supported");
prte->inFromCl = false;
m_ulResultRelation = gpdb::UlListLength(*(m_pplRTable));
GPOS_ASSERT(0 == m_result_relation_index && "Only one result relation supported");
rte->inFromCl = false;
m_result_relation_index = gpdb::ListLength(*(m_rtable_entries_list));
}
}
......@@ -271,9 +271,9 @@ CContextDXLToPlStmt::AddPartitionedTable
OID oid
)
{
if (!gpdb::FMemberOid(m_plPartitionTables, oid))
if (!gpdb::ListMemberOid(m_partitioned_tables_list, oid))
{
m_plPartitionTables = gpdb::PlAppendOid(m_plPartitionTables, oid);
m_partitioned_tables_list = gpdb::LAppendOid(m_partitioned_tables_list, oid);
}
}
......@@ -288,41 +288,41 @@ CContextDXLToPlStmt::AddPartitionedTable
void
CContextDXLToPlStmt::IncrementPartitionSelectors
(
ULONG ulScanId
ULONG scan_id
)
{
// add extra elements to the array if necessary
const ULONG ulLen = m_pdrgpulNumSelectors->UlLength();
for (ULONG ul = ulLen; ul <= ulScanId; ul++)
const ULONG len = m_num_partition_selectors_array->Size();
for (ULONG ul = len; ul <= scan_id; ul++)
{
ULONG *pul = GPOS_NEW(m_pmp) ULONG(0);
m_pdrgpulNumSelectors->Append(pul);
ULONG *pul = GPOS_NEW(m_mp) ULONG(0);
m_num_partition_selectors_array->Append(pul);
}
ULONG *pul = (*m_pdrgpulNumSelectors)[ulScanId];
(*pul) ++;
ULONG *ul = (*m_num_partition_selectors_array)[scan_id];
(*ul) ++;
}
//---------------------------------------------------------------------------
// @function:
// CContextDXLToPlStmt::PlNumPartitionSelectors
// CContextDXLToPlStmt::GetNumPartitionSelectorsList
//
// @doc:
// Return list containing number of partition selectors for every scan id
//
//---------------------------------------------------------------------------
List *
CContextDXLToPlStmt::PlNumPartitionSelectors() const
CContextDXLToPlStmt::GetNumPartitionSelectorsList() const
{
List *pl = NIL;
const ULONG ulLen = m_pdrgpulNumSelectors->UlLength();
for (ULONG ul = 0; ul < ulLen; ul++)
List *partition_selectors_list = NIL;
const ULONG len = m_num_partition_selectors_array->Size();
for (ULONG ul = 0; ul < len; ul++)
{
ULONG *pul = (*m_pdrgpulNumSelectors)[ul];
pl = gpdb::PlAppendInt(pl, *pul);
ULONG *num_partition_selectors = (*m_num_partition_selectors_array)[ul];
partition_selectors_list = gpdb::LAppendInt(partition_selectors_list, *num_partition_selectors);
}
return pl;
return partition_selectors_list;
}
//---------------------------------------------------------------------------
......@@ -334,9 +334,9 @@ CContextDXLToPlStmt::PlNumPartitionSelectors() const
//
//---------------------------------------------------------------------------
void
CContextDXLToPlStmt::AddSubplan(Plan *pplan)
CContextDXLToPlStmt::AddSubplan(Plan *plan)
{
(* (m_pplSubPlan)) = gpdb::PlAppendElement((*(m_pplSubPlan)), pplan);
(* (m_subplan_entries_list)) = gpdb::LAppend((*(m_subplan_entries_list)), plan);
}
//---------------------------------------------------------------------------
......@@ -352,15 +352,15 @@ CContextDXLToPlStmt::AddSubplan(Plan *pplan)
void
CContextDXLToPlStmt::AddCtasInfo
(
IntoClause *pintocl,
GpPolicy *pdistrpolicy
IntoClause *into_clause,
GpPolicy *distribution_policy
)
{
// GPOS_ASSERT(NULL != pintocl);
GPOS_ASSERT(NULL != pdistrpolicy);
// GPOS_ASSERT(NULL != into_clause);
GPOS_ASSERT(NULL != distribution_policy);
m_pintocl = pintocl;
m_pdistrpolicy = pdistrpolicy;
m_into_clause = into_clause;
m_distribution_policy = distribution_policy;
}
// EOF
......@@ -28,16 +28,16 @@ using namespace gpos;
//---------------------------------------------------------------------------
CDXLTranslateContext::CDXLTranslateContext
(
IMemoryPool *pmp,
BOOL fChildAggNode
IMemoryPool *mp,
BOOL is_child_agg_node
)
:
m_pmp(pmp),
m_fChildAggNode(fChildAggNode)
m_mp(mp),
m_is_child_agg_node(is_child_agg_node)
{
// initialize hash table
m_phmulte = GPOS_NEW(m_pmp) HMUlTe(m_pmp);
m_phmcolparam = GPOS_NEW(m_pmp) HMColParam(m_pmp);
m_colid_to_target_entry_map = GPOS_NEW(m_mp) ULongToTargetEntryMap(m_mp);
m_colid_to_paramid_map = GPOS_NEW(m_mp) ULongToColParamMap(m_mp);
}
//---------------------------------------------------------------------------
......@@ -50,17 +50,17 @@ CDXLTranslateContext::CDXLTranslateContext
//---------------------------------------------------------------------------
CDXLTranslateContext::CDXLTranslateContext
(
IMemoryPool *pmp,
BOOL fChildAggNode,
HMColParam *phmOriginal
IMemoryPool *mp,
BOOL is_child_agg_node,
ULongToColParamMap *original
)
:
m_pmp(pmp),
m_fChildAggNode(fChildAggNode)
m_mp(mp),
m_is_child_agg_node(is_child_agg_node)
{
m_phmulte = GPOS_NEW(m_pmp) HMUlTe(m_pmp);
m_phmcolparam = GPOS_NEW(m_pmp) HMColParam(m_pmp);
CopyParamHashmap(phmOriginal);
m_colid_to_target_entry_map = GPOS_NEW(m_mp) ULongToTargetEntryMap(m_mp);
m_colid_to_paramid_map = GPOS_NEW(m_mp) ULongToColParamMap(m_mp);
CopyParamHashmap(original);
}
//---------------------------------------------------------------------------
......@@ -73,22 +73,22 @@ CDXLTranslateContext::CDXLTranslateContext
//---------------------------------------------------------------------------
CDXLTranslateContext::~CDXLTranslateContext()
{
m_phmulte->Release();
m_phmcolparam->Release();
m_colid_to_target_entry_map->Release();
m_colid_to_paramid_map->Release();
}
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContext::FParentAggNode
// CDXLTranslateContext::IsParentAggNode
//
// @doc:
// Is this translation context created by a parent Agg node
//
//---------------------------------------------------------------------------
BOOL
CDXLTranslateContext::FParentAggNode() const
CDXLTranslateContext::IsParentAggNode() const
{
return m_fChildAggNode;
return m_is_child_agg_node;
}
//---------------------------------------------------------------------------
......@@ -102,56 +102,56 @@ CDXLTranslateContext::FParentAggNode() const
void
CDXLTranslateContext::CopyParamHashmap
(
HMColParam *phmOriginal
ULongToColParamMap *original
)
{
// iterate over full map
HMColParamIter hashmapiter(phmOriginal);
while (hashmapiter.FAdvance())
ULongToColParamMapIter hashmapiter(original);
while (hashmapiter.Advance())
{
CMappingElementColIdParamId *pmecolidparamid = const_cast<CMappingElementColIdParamId *>(hashmapiter.Pt());
CMappingElementColIdParamId *colidparamid = const_cast<CMappingElementColIdParamId *>(hashmapiter.Value());
const ULONG ulColId = pmecolidparamid->UlColId();
ULONG *pulKey = GPOS_NEW(m_pmp) ULONG(ulColId);
pmecolidparamid->AddRef();
m_phmcolparam->FInsert(pulKey, pmecolidparamid);
const ULONG colid = colidparamid->GetColId();
ULONG *key = GPOS_NEW(m_mp) ULONG(colid);
colidparamid->AddRef();
m_colid_to_paramid_map->Insert(key, colidparamid);
}
}
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContext::Pte
// CDXLTranslateContext::GetTargetEntry
//
// @doc:
// Lookup target entry associated with a given col id
//
//---------------------------------------------------------------------------
const TargetEntry *
CDXLTranslateContext::Pte
CDXLTranslateContext::GetTargetEntry
(
ULONG ulColId
ULONG colid
)
const
{
return m_phmulte->PtLookup(&ulColId);
return m_colid_to_target_entry_map->Find(&colid);
}
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContext::Pmecolidparamid
// CDXLTranslateContext::GetParamIdMappingElement
//
// @doc:
// Lookup col->param mapping associated with a given col id
//
//---------------------------------------------------------------------------
const CMappingElementColIdParamId *
CDXLTranslateContext::Pmecolidparamid
CDXLTranslateContext::GetParamIdMappingElement
(
ULONG ulColId
ULONG colid
)
const
{
return m_phmcolparam->PtLookup(&ulColId);
return m_colid_to_paramid_map->Find(&colid);
}
//---------------------------------------------------------------------------
......@@ -165,19 +165,19 @@ CDXLTranslateContext::Pmecolidparamid
void
CDXLTranslateContext::InsertMapping
(
ULONG ulColId,
TargetEntry *pte
ULONG colid,
TargetEntry *target_entry
)
{
// copy key
ULONG *pulKey = GPOS_NEW(m_pmp) ULONG(ulColId);
ULONG *key = GPOS_NEW(m_mp) ULONG(colid);
// insert colid->target entry mapping in the hash map
BOOL fResult = m_phmulte->FInsert(pulKey, pte);
BOOL result = m_colid_to_target_entry_map->Insert(key, target_entry);
if (!fResult)
if (!result)
{
GPOS_DELETE(pulKey);
GPOS_DELETE(key);
}
}
......@@ -192,15 +192,15 @@ CDXLTranslateContext::InsertMapping
BOOL
CDXLTranslateContext::FInsertParamMapping
(
ULONG ulColId,
CMappingElementColIdParamId *pmecolidparamid
ULONG colid,
CMappingElementColIdParamId *colidparamid
)
{
// copy key
ULONG *pulKey = GPOS_NEW(m_pmp) ULONG(ulColId);
ULONG *key = GPOS_NEW(m_mp) ULONG(colid);
// insert colid->target entry mapping in the hash map
return m_phmcolparam->FInsert(pulKey, pmecolidparamid);
return m_colid_to_paramid_map->Insert(key, colidparamid);
}
// EOF
......@@ -29,15 +29,15 @@ using namespace gpos;
//---------------------------------------------------------------------------
CDXLTranslateContextBaseTable::CDXLTranslateContextBaseTable
(
IMemoryPool *pmp
IMemoryPool *mp
)
:
m_pmp(pmp),
m_mp(mp),
m_oid(InvalidOid),
m_iRel(0)
m_rel_index(0)
{
// initialize hash table
m_phmuli = GPOS_NEW(m_pmp) HMUlI(m_pmp);
m_colid_to_attno_map = GPOS_NEW(m_mp) UlongToIntMap(m_mp);
}
//---------------------------------------------------------------------------
......@@ -50,7 +50,7 @@ CDXLTranslateContextBaseTable::CDXLTranslateContextBaseTable
//---------------------------------------------------------------------------
CDXLTranslateContextBaseTable::~CDXLTranslateContextBaseTable()
{
CRefCount::SafeRelease(m_phmuli);
CRefCount::SafeRelease(m_colid_to_attno_map);
}
......@@ -81,61 +81,61 @@ CDXLTranslateContextBaseTable::SetOID
//
//---------------------------------------------------------------------------
void
CDXLTranslateContextBaseTable::SetIdx
CDXLTranslateContextBaseTable::SetRelIndex
(
Index iRel
Index rel_index
)
{
GPOS_ASSERT(0 < iRel);
m_iRel = iRel;
GPOS_ASSERT(0 < rel_index);
m_rel_index = rel_index;
}
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContextBaseTable::OidRel
// CDXLTranslateContextBaseTable::GetOid
//
// @doc:
// Returns the oid of the table
//
//---------------------------------------------------------------------------
OID
CDXLTranslateContextBaseTable::OidRel() const
CDXLTranslateContextBaseTable::GetOid() const
{
return m_oid;
}
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContextBaseTable::IRel
// CDXLTranslateContextBaseTable::GetRelIndex
//
// @doc:
// Returns the index of the relation in the rable table
//
//---------------------------------------------------------------------------
Index
CDXLTranslateContextBaseTable::IRel() const
CDXLTranslateContextBaseTable::GetRelIndex() const
{
GPOS_ASSERT(0 < m_iRel);
return m_iRel;
GPOS_ASSERT(0 < m_rel_index);
return m_rel_index;
}
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContextBaseTable::IAttnoForColId
// CDXLTranslateContextBaseTable::GetAttnoForColId
//
// @doc:
// Lookup the index of the attribute with the DXL col id in the underlying table schema
//
//---------------------------------------------------------------------------
INT
CDXLTranslateContextBaseTable::IAttnoForColId
CDXLTranslateContextBaseTable::GetAttnoForColId
(
ULONG ulColId
ULONG colid
)
const
{
const INT *pi = m_phmuli->PtLookup(&ulColId);
const INT *pi = m_colid_to_attno_map->Find(&colid);
if (NULL != pi)
{
return *pi;
......@@ -147,7 +147,7 @@ CDXLTranslateContextBaseTable::IAttnoForColId
//---------------------------------------------------------------------------
// @function:
// CDXLTranslateContextBaseTable::FInsertMapping
// CDXLTranslateContextBaseTable::InsertMapping
//
// @doc:
// Insert a mapping ColId->Idx, where ulDXLColId is a DXL introduced column id,
......@@ -155,23 +155,23 @@ CDXLTranslateContextBaseTable::IAttnoForColId
//
//---------------------------------------------------------------------------
BOOL
CDXLTranslateContextBaseTable::FInsertMapping
CDXLTranslateContextBaseTable::InsertMapping
(
ULONG ulDXLColId,
INT iAttno
ULONG dxl_colid,
INT att_no
)
{
// copy key and value
ULONG *pulKey = GPOS_NEW(m_pmp) ULONG(ulDXLColId);
INT *piValue = GPOS_NEW(m_pmp) INT(iAttno);
ULONG *key = GPOS_NEW(m_mp) ULONG(dxl_colid);
INT *value = GPOS_NEW(m_mp) INT(att_no);
// insert colid-idx mapping in the hash map
BOOL fRes = m_phmuli->FInsert(pulKey, piValue);
BOOL res = m_colid_to_attno_map->Insert(key, value);
GPOS_ASSERT(fRes);
GPOS_ASSERT(res);
return fRes;
return res;
}
// EOF
......@@ -27,10 +27,10 @@ using namespace gpdxl;
//---------------------------------------------------------------------------
CMappingColIdVar::CMappingColIdVar
(
IMemoryPool *pmp
IMemoryPool *mp
)
:
m_pmp(pmp)
m_mp(mp)
{
}
......
......@@ -43,80 +43,80 @@ using namespace gpmd;
//---------------------------------------------------------------------------
CMappingColIdVarPlStmt::CMappingColIdVarPlStmt
(
IMemoryPool *pmp,
const CDXLTranslateContextBaseTable *pdxltrctxbt,
DrgPdxltrctx *pdrgpdxltrctx,
CDXLTranslateContext *pdxltrctxOut,
CContextDXLToPlStmt *pctxdxltoplstmt
IMemoryPool *mp,
const CDXLTranslateContextBaseTable *base_table_context,
CDXLTranslationContextArray *child_contexts,
CDXLTranslateContext *output_context,
CContextDXLToPlStmt *dxl_to_plstmt_context
)
:
CMappingColIdVar(pmp),
m_pdxltrctxbt(pdxltrctxbt),
m_pdrgpdxltrctx(pdrgpdxltrctx),
m_pdxltrctxOut(pdxltrctxOut),
m_pctxdxltoplstmt(pctxdxltoplstmt)
CMappingColIdVar(mp),
m_base_table_context(base_table_context),
m_child_contexts(child_contexts),
m_output_context(output_context),
m_dxl_to_plstmt_context(dxl_to_plstmt_context)
{
}
//---------------------------------------------------------------------------
// @function:
// CMappingColIdVarPlStmt::Pctxdxltoplstmt
// CMappingColIdVarPlStmt::GetDXLToPlStmtContext
//
// @doc:
// Returns the DXL->PlStmt translation context
//
//---------------------------------------------------------------------------
CContextDXLToPlStmt *
CMappingColIdVarPlStmt::Pctxdxltoplstmt()
CMappingColIdVarPlStmt::GetDXLToPlStmtContext()
{
return m_pctxdxltoplstmt;
return m_dxl_to_plstmt_context;
}
//---------------------------------------------------------------------------
// @function:
// CMappingColIdVarPlStmt::PpdxltrctxOut
// CMappingColIdVarPlStmt::GetOutputContext
//
// @doc:
// Returns the output translation context
//
//---------------------------------------------------------------------------
CDXLTranslateContext *
CMappingColIdVarPlStmt::PpdxltrctxOut()
CMappingColIdVarPlStmt::GetOutputContext()
{
return m_pdxltrctxOut;
return m_output_context;
}
//---------------------------------------------------------------------------
// @function:
// CMappingColIdVarPlStmt::PparamFromDXLNodeScId
// CMappingColIdVarPlStmt::ParamFromDXLNodeScId
//
// @doc:
// Translates a DXL scalar identifier operator into a GPDB Param node
//
//---------------------------------------------------------------------------
Param *
CMappingColIdVarPlStmt::PparamFromDXLNodeScId
CMappingColIdVarPlStmt::ParamFromDXLNodeScId
(
const CDXLScalarIdent *pdxlop
const CDXLScalarIdent *dxlop
)
{
GPOS_ASSERT(NULL != m_pdxltrctxOut);
GPOS_ASSERT(NULL != m_output_context);
Param *pparam = NULL;
Param *param = NULL;
const ULONG ulColId = pdxlop->Pdxlcr()->UlID();
const CMappingElementColIdParamId *pmecolidparamid = m_pdxltrctxOut->Pmecolidparamid(ulColId);
const ULONG colid = dxlop->GetDXLColRef()->Id();
const CMappingElementColIdParamId *elem = m_output_context->GetParamIdMappingElement(colid);
if (NULL != pmecolidparamid)
if (NULL != elem)
{
pparam = MakeNode(Param);
pparam->paramkind = PARAM_EXEC;
pparam->paramid = pmecolidparamid->UlParamId();
pparam->paramtype = CMDIdGPDB::PmdidConvert(pmecolidparamid->PmdidType())->OidObjectId();
pparam->paramtypmod = pmecolidparamid->ITypeModifier();
param = MakeNode(Param);
param->paramkind = PARAM_EXEC;
param->paramid = elem->ParamId();
param->paramtype = CMDIdGPDB::CastMdid(elem->MdidType())->Oid();
param->paramtypmod = elem->TypeModifier();
}
return pparam;
return param;
}
//---------------------------------------------------------------------------
......@@ -128,119 +128,117 @@ CMappingColIdVarPlStmt::PparamFromDXLNodeScId
//
//---------------------------------------------------------------------------
Var *
CMappingColIdVarPlStmt::PvarFromDXLNodeScId
CMappingColIdVarPlStmt::VarFromDXLNodeScId
(
const CDXLScalarIdent *pdxlop
const CDXLScalarIdent *dxlop
)
{
Index idxVarno = 0;
Index varno = 0;
AttrNumber attno = 0;
Index idxVarnoold = 0;
AttrNumber attnoOld = 0;
Index varno_old = 0;
AttrNumber attno_old = 0;
const ULONG ulColId = pdxlop->Pdxlcr()->UlID();
if (NULL != m_pdxltrctxbt)
const ULONG colid = dxlop->GetDXLColRef()->Id();
if (NULL != m_base_table_context)
{
// scalar id is used in a base table operator node
idxVarno = m_pdxltrctxbt->IRel();
attno = (AttrNumber) m_pdxltrctxbt->IAttnoForColId(ulColId);
varno = m_base_table_context->GetRelIndex();
attno = (AttrNumber) m_base_table_context->GetAttnoForColId(colid);
idxVarnoold = idxVarno;
attnoOld = attno;
varno_old = varno;
attno_old = attno;
}
// if lookup has failed in the first step, attempt lookup again using outer and inner contexts
if (0 == attno && NULL != m_pdrgpdxltrctx)
if (0 == attno && NULL != m_child_contexts)
{
GPOS_ASSERT(0 != m_pdrgpdxltrctx->UlLength());
GPOS_ASSERT(0 != m_child_contexts->Size());
const CDXLTranslateContext *pdxltrctxLeft = (*m_pdrgpdxltrctx)[0];
// const CDXLTranslateContext *pdxltrctxRight
const CDXLTranslateContext *left_context = (*m_child_contexts)[0];
// not a base table
GPOS_ASSERT(NULL != pdxltrctxLeft);
GPOS_ASSERT(NULL != left_context);
// lookup column in the left child translation context
const TargetEntry *pte = pdxltrctxLeft->Pte(ulColId);
const TargetEntry *target_entry = left_context->GetTargetEntry(colid);
if (NULL != pte)
if (NULL != target_entry)
{
// identifier comes from left child
idxVarno = OUTER_VAR;
varno = OUTER_VAR;
}
else
{
const ULONG ulContexts = m_pdrgpdxltrctx->UlLength();
if (2 > ulContexts)
const ULONG num_contexts = m_child_contexts->Size();
if (2 > num_contexts)
{
// there are no more children. col id not found in this tree
// and must be an outer ref
return NULL;
}
const CDXLTranslateContext *pdxltrctxRight = (*m_pdrgpdxltrctx)[1];
const CDXLTranslateContext *right_context = (*m_child_contexts)[1];
// identifier must come from right child
GPOS_ASSERT(NULL != pdxltrctxRight);
GPOS_ASSERT(NULL != right_context);
pte = pdxltrctxRight->Pte(ulColId);
target_entry = right_context->GetTargetEntry(colid);
idxVarno = INNER_VAR;
varno = INNER_VAR;
// check any additional contexts if col is still not found yet
for (ULONG ul = 2; NULL == pte && ul < ulContexts; ul++)
for (ULONG ul = 2; NULL == target_entry && ul < num_contexts; ul++)
{
const CDXLTranslateContext *pdxltrctx = (*m_pdrgpdxltrctx)[ul];
GPOS_ASSERT(NULL != pdxltrctx);
const CDXLTranslateContext *context = (*m_child_contexts)[ul];
GPOS_ASSERT(NULL != context);
pte = pdxltrctx->Pte(ulColId);
if (NULL == pte)
target_entry = context->GetTargetEntry(colid);
if (NULL == target_entry)
{
continue;
}
Var *pv = (Var*) pte->expr;
idxVarno = pv->varno;
Var *var = (Var*) target_entry->expr;
varno = var->varno;
}
}
if (NULL == pte)
if (NULL == target_entry)
{
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXL2PlStmtAttributeNotFound, ulColId);
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXL2PlStmtAttributeNotFound, colid);
}
attno = pte->resno;
attno = target_entry->resno;
// find the original varno and attno for this column
if (IsA(pte->expr, Var))
if (IsA(target_entry->expr, Var))
{
Var *pv = (Var*) pte->expr;
idxVarnoold = pv->varnoold;
attnoOld = pv->varoattno;
Var *var = (Var*) target_entry->expr;
varno_old = var->varnoold;
attno_old = var->varoattno;
}
else
{
idxVarnoold = idxVarno;
attnoOld = attno;
varno_old = varno;
attno_old = attno;
}
}
Var *pvar = gpdb::PvarMakeVar
Var *var = gpdb::MakeVar
(
idxVarno,
varno,
attno,
CMDIdGPDB::PmdidConvert(pdxlop->PmdidType())->OidObjectId(),
pdxlop->ITypeModifier(),
CMDIdGPDB::CastMdid(dxlop->MdidType())->Oid(),
dxlop->TypeModifier(),
0 // varlevelsup
);
// set varnoold and varoattno since makeVar does not set them properly
pvar->varnoold = idxVarnoold;
pvar->varoattno = attnoOld;
var->varnoold = varno_old;
var->varoattno = attno_old;
return pvar;
return var;
}
// EOF
......@@ -33,16 +33,16 @@ using namespace gpos;
//---------------------------------------------------------------------------
CMappingElementColIdParamId::CMappingElementColIdParamId
(
ULONG ulColId,
ULONG ulParamId,
IMDId *pmdid,
INT iTypeModifier
ULONG colid,
ULONG paramid,
IMDId *mdid,
INT type_modifier
)
:
m_ulColId(ulColId),
m_ulParamId(ulParamId),
m_pmdid(pmdid),
m_iTypeModifier(iTypeModifier)
m_colid(colid),
m_paramid(paramid),
m_mdid(mdid),
m_type_modifier(type_modifier)
{
}
......
......@@ -33,14 +33,14 @@ using namespace gpos;
//---------------------------------------------------------------------------
CMappingElementColIdTE::CMappingElementColIdTE
(
ULONG ulColId,
ULONG ulQueryLevel,
TargetEntry *pte
ULONG colid,
ULONG query_level,
TargetEntry *target_entry
)
:
m_ulColId(ulColId),
m_ulQueryLevel(ulQueryLevel),
m_pte(pte)
m_colid(colid),
m_query_level(query_level),
m_target_entry(target_entry)
{
}
......
......@@ -17,57 +17,57 @@
//---------------------------------------------------------------------------
// @function:
// CCatalogUtils::PlRelationOids
// CCatalogUtils::GetRelationOids
//
// @doc:
// Return list of relation oids from the catalog
//
//---------------------------------------------------------------------------
List *
CCatalogUtils::PlRelationOids()
CCatalogUtils::GetRelationOids()
{
return relation_oids();
}
//---------------------------------------------------------------------------
// @function:
// CCatalogUtils::PlOperatorOids
// CCatalogUtils::GetOperatorOids
//
// @doc:
// Return list of operator oids from the catalog
//
//---------------------------------------------------------------------------
List *
CCatalogUtils::PlOperatorOids()
CCatalogUtils::GetOperatorOids()
{
return operator_oids();
}
//---------------------------------------------------------------------------
// @function:
// CCatalogUtils::PlFunctionOids
// CCatalogUtils::GetFunctionOids
//
// @doc:
// Return list of function plOids from the catalog
// Return list of function oids_list from the catalog
//
//---------------------------------------------------------------------------
List *
CCatalogUtils::PlFunctionOids()
CCatalogUtils::GetFunctionOids()
{
return function_oids();
}
//---------------------------------------------------------------------------
// @function:
// CCatalogUtils::PlAllOids
// CCatalogUtils::GetAllOids
//
// @doc:
// Return list of all plOids from the catalog
// Return list of all oids_list from the catalog
//
//---------------------------------------------------------------------------
List *CCatalogUtils::PlAllOids()
List *CCatalogUtils::GetAllOids()
{
return list_concat(list_concat(PlRelationOids(), PlOperatorOids()), PlFunctionOids());
return list_concat(list_concat(GetRelationOids(), GetOperatorOids()), GetFunctionOids());
}
// EOF
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -69,7 +69,7 @@ extern "C" {
#include "funcapi.h"
extern
Query *preprocess_query_optimizer(Query *pquery, ParamListInfo boundParams);
Query *preprocess_query_optimizer(Query *query, ParamListInfo boundParams);
extern
List *pg_parse_and_rewrite(const char *query_string, Oid *paramTypes, int iNumParams);
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册