本文整理汇总了C++中ResetExprContext函数的典型用法代码示例。如果您正苦于以下问题:C++ ResetExprContext函数的具体用法?C++ ResetExprContext怎么用?C++ ResetExprContext使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResetExprContext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecDynamicIndexReScan
/*
* Allow rescanning an index.
*/
void
ExecDynamicIndexReScan(DynamicIndexScanState *node, ExprContext *exprCtxt)
{
DynamicIndexScanEndCurrentScan(node);
/* Force reloading the hash table */
node->pidxIndex = NULL;
/* Context for runtime keys */
ExprContext *econtext = node->indexScanState.iss_RuntimeContext;
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for runtime key
* calc. We also need to link it into the "regular" per-tuple
* econtext, so it can be used during indexqualorig evaluations.
*/
if (exprCtxt != NULL)
{
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
ExprContext *stdecontext = node->indexScanState.ss.ps.ps_ExprContext;
stdecontext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
}
/*
* Reset the runtime-key context so we don't leak memory as each outer
* tuple is scanned. Note this assumes that we will recalculate *all*
* runtime keys on each call.
*/
ResetExprContext(econtext);
}
CheckSendPlanStateGpmonPkt(&node->indexScanState.ss.ps);
}
示例2: ExecReScanIndexScan
/* ----------------------------------------------------------------
* ExecReScanIndexScan(node)
*
* Recalculates the values of any scan keys whose value depends on
* information known at runtime, then rescans the indexed relation.
*
* Updating the scan key was formerly done separately in
* ExecUpdateIndexScanKeys. Integrating it into ReScan makes
* rescans of indices and relations/general streams more uniform.
* ----------------------------------------------------------------
*/
void
ExecReScanIndexScan(IndexScanState *node)
{
/*
* If we are doing runtime key calculations (ie, any of the index key
* values weren't simple Consts), compute the new key values. But first,
* reset the context so we don't leak memory as each outer tuple is
* scanned. Note this assumes that we will recalculate *all* runtime keys
* on each call.
*/
if (node->iss_NumRuntimeKeys != 0)
{
ExprContext *econtext = node->iss_RuntimeContext;
ResetExprContext(econtext);
ExecIndexEvalRuntimeKeys(econtext,
node->iss_RuntimeKeys,
node->iss_NumRuntimeKeys);
}
node->iss_RuntimeKeysReady = true;
/* reset index scan */
index_rescan(node->iss_ScanDesc,
node->iss_ScanKeys, node->iss_NumScanKeys,
node->iss_OrderByKeys, node->iss_NumOrderByKeys);
ExecScanReScan(&node->ss);
}
示例3: ForeignRecheck
/*
* ForeignRecheck -- access method routine to recheck a tuple in EvalPlanQual
*/
static bool
ForeignRecheck(ForeignScanState *node, TupleTableSlot *slot)
{
FdwRoutine *fdwroutine = node->fdwroutine;
ExprContext *econtext;
/*
* extract necessary information from foreign scan node
*/
econtext = node->ss.ps.ps_ExprContext;
/* Does the tuple meet the remote qual condition? */
econtext->ecxt_scantuple = slot;
ResetExprContext(econtext);
/*
* If an outer join is pushed down, RecheckForeignScan may need to store a
* different tuple in the slot, because a different set of columns may go
* to NULL upon recheck. Otherwise, it shouldn't need to change the slot
* contents, just return true or false to indicate whether the quals still
* pass. For simple cases, setting fdw_recheck_quals may be easier than
* providing this callback.
*/
if (fdwroutine->RecheckForeignScan &&
!fdwroutine->RecheckForeignScan(node, slot))
return false;
return ExecQual(node->fdw_recheck_quals, econtext, false);
}
示例4: ExecDynamicTableReScan
/*
* ExecDynamicTableReScan
* Prepares the internal states for a rescan.
*/
void
ExecDynamicTableReScan(DynamicTableScanState *node, ExprContext *exprCtxt)
{
DynamicTableScanEndCurrentScan(node);
/* Force reloading the partition hash table */
node->pidIndex = NULL;
ExprContext *econtext = node->tableScanState.ss.ps.ps_ExprContext;
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for any expression
* evaluation that may refer to the outer tuple.
*/
if (exprCtxt != NULL)
{
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
}
/*
* Reset the expression context so we don't leak memory as each outer
* tuple is scanned.
*/
ResetExprContext(econtext);
}
Gpmon_M_Incr(GpmonPktFromDynamicTableScanState(node), GPMON_DYNAMICTABLESCAN_RESCAN);
CheckSendPlanStateGpmonPkt(&node->tableScanState.ss.ps);
}
示例5: ExecIndexReScan
/* ----------------------------------------------------------------
* ExecIndexReScan(node)
*
* Recalculates the value of the scan keys whose value depends on
* information known at runtime and rescans the indexed relation.
* Updating the scan key was formerly done separately in
* ExecUpdateIndexScanKeys. Integrating it into ReScan makes
* rescans of indices and relations/general streams more uniform.
* ----------------------------------------------------------------
*/
void
ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt)
{
EState *estate;
ExprContext *econtext;
Index scanrelid;
estate = node->ss.ps.state;
econtext = node->iss_RuntimeContext; /* context for runtime keys */
scanrelid = ((IndexScan *) node->ss.ps.plan)->scan.scanrelid;
node->ss.ps.ps_TupFromTlist = false;
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for runtime key
* calc. We also need to link it into the "regular" per-tuple
* econtext, so it can be used during indexqualorig evaluations.
*/
if (exprCtxt != NULL)
{
ExprContext *stdecontext;
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
stdecontext = node->ss.ps.ps_ExprContext;
stdecontext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
}
/*
* Reset the runtime-key context so we don't leak memory as each outer
* tuple is scanned. Note this assumes that we will recalculate *all*
* runtime keys on each call.
*/
ResetExprContext(econtext);
}
/*
* If we are doing runtime key calculations (ie, the index keys depend on
* data from an outer scan), compute the new key values
*/
if (node->iss_NumRuntimeKeys != 0)
ExecIndexEvalRuntimeKeys(econtext,
node->iss_RuntimeKeys,
node->iss_NumRuntimeKeys);
node->iss_RuntimeKeysReady = true;
/* If this is re-scanning of PlanQual ... */
if (estate->es_evTuple != NULL &&
estate->es_evTuple[scanrelid - 1] != NULL)
{
estate->es_evTupleNull[scanrelid - 1] = false;
return;
}
/* reset index scan */
index_rescan(node->iss_ScanDesc, node->iss_ScanKeys);
}
示例6: IndexRecheck
/*
* IndexRecheck -- access method routine to recheck a tuple in EvalPlanQual
*/
static bool
IndexRecheck(index_ss *node, struct tupslot *slot)
{
expr_ctx_n *econtext;
/*
* extract necessary information from index scan node
*/
econtext = node->ss.ps.ps_ExprContext;
/* Does the tuple meet the indexqual condition? */
econtext->ecxt_scantuple = slot;
ResetExprContext(econtext);
return exec_qual(node->indexqualorig, econtext, false);
}
示例7: ExecBitmapIndexReScan
/* ----------------------------------------------------------------
* ExecBitmapIndexReScan(node)
*
* Recalculates the value of the scan keys whose value depends on
* information known at runtime and rescans the indexed relation.
* ----------------------------------------------------------------
*/
void
ExecBitmapIndexReScan(BitmapIndexScanState *node, ExprContext *exprCtxt)
{
ExprContext *econtext;
econtext = node->biss_RuntimeContext; /* context for runtime keys */
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for runtime key
* calc.
*/
if (exprCtxt != NULL)
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
/*
* Reset the runtime-key context so we don't leak memory as each outer
* tuple is scanned. Note this assumes that we will recalculate *all*
* runtime keys on each call.
*/
ResetExprContext(econtext);
}
/*
* If we are doing runtime key calculations (ie, the index keys depend on
* data from an outer scan), compute the new key values.
*
* Array keys are also treated as runtime keys; note that if we return
* with biss_RuntimeKeysReady still false, then there is an empty array
* key so no index scan is needed.
*/
if (node->biss_NumRuntimeKeys != 0)
ExecIndexEvalRuntimeKeys(econtext,
node->biss_RuntimeKeys,
node->biss_NumRuntimeKeys);
if (node->biss_NumArrayKeys != 0)
node->biss_RuntimeKeysReady =
ExecIndexEvalArrayKeys(econtext,
node->biss_ArrayKeys,
node->biss_NumArrayKeys);
else
node->biss_RuntimeKeysReady = true;
/* reset index scan */
if (node->biss_RuntimeKeysReady)
index_rescan(node->biss_ScanDesc, node->biss_ScanKeys);
}
示例8: ExecIndexReScan
/* ----------------------------------------------------------------
* ExecIndexReScan(node)
*
* Recalculates the value of the scan keys whose value depends on
* information known at runtime and rescans the indexed relation.
* Updating the scan key was formerly done separately in
* ExecUpdateIndexScanKeys. Integrating it into ReScan makes
* rescans of indices and relations/general streams more uniform.
* ----------------------------------------------------------------
*/
void
ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt)
{
ExprContext *econtext;
econtext = node->iss_RuntimeContext; /* context for runtime keys */
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for runtime key
* calc. We also need to link it into the "regular" per-tuple
* econtext, so it can be used during indexqualorig evaluations.
*/
if (exprCtxt != NULL)
{
ExprContext *stdecontext;
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
stdecontext = node->ss.ps.ps_ExprContext;
stdecontext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
}
/*
* Reset the runtime-key context so we don't leak memory as each outer
* tuple is scanned. Note this assumes that we will recalculate *all*
* runtime keys on each call.
*/
ResetExprContext(econtext);
}
/*
* If we are doing runtime key calculations (ie, the index keys depend on
* data from an outer scan), compute the new key values
*/
if (node->iss_NumRuntimeKeys != 0)
ExecIndexEvalRuntimeKeys(econtext,
node->iss_RuntimeKeys,
node->iss_NumRuntimeKeys);
node->iss_RuntimeKeysReady = true;
/* reset index scan */
index_rescan(node->iss_ScanDesc, node->iss_ScanKeys);
ExecScanReScan(&node->ss);
}
示例9: IndexRecheck
/*
* IndexRecheck -- access method routine to recheck a tuple in EvalPlanQual
*/
static bool
IndexRecheck(IndexScanState *node, TupleTableSlot *slot)
{
ExprContext *econtext;
/*
* extract necessary information from index scan node
*/
econtext = node->ss.ps.ps_ExprContext;
/* Does the tuple meet the indexqual condition? */
econtext->ecxt_scantuple = slot;
ResetExprContext(econtext);
return ExecQual(node->indexqualorig, econtext, false);
}
示例10: BitmapHeapRecheck
/*
* BitmapHeapRecheck -- access method routine to recheck a tuple in EvalPlanQual
*/
static bool
BitmapHeapRecheck(BitmapHeapScanState *node, TupleTableSlot *slot)
{
ExprContext *econtext;
/*
* extract necessary information from index scan node
*/
econtext = node->ss.ps.ps_ExprContext;
/* Does the tuple meet the original qual conditions? */
econtext->ecxt_scantuple = slot;
ResetExprContext(econtext);
return ExecQual(node->bitmapqualorig, econtext);
}
示例11: ExecReScanIndexOnlyScan
/* ----------------------------------------------------------------
* ExecReScanIndexOnlyScan(node)
*
* Recalculates the values of any scan keys whose value depends on
* information known at runtime, then rescans the indexed relation.
*
* Updating the scan key was formerly done separately in
* ExecUpdateIndexScanKeys. Integrating it into ReScan makes
* rescans of indices and relations/general streams more uniform.
* ----------------------------------------------------------------
*/
void
ExecReScanIndexOnlyScan(IndexOnlyScanState *node)
{
bool reset_parallel_scan = true;
/*
* If we are here to just update the scan keys, then don't reset parallel
* scan. For detailed reason behind this look in the comments for
* ExecReScanIndexScan.
*/
if (node->ioss_NumRuntimeKeys != 0 && !node->ioss_RuntimeKeysReady)
reset_parallel_scan = false;
/*
* If we are doing runtime key calculations (ie, any of the index key
* values weren't simple Consts), compute the new key values. But first,
* reset the context so we don't leak memory as each outer tuple is
* scanned. Note this assumes that we will recalculate *all* runtime keys
* on each call.
*/
if (node->ioss_NumRuntimeKeys != 0)
{
ExprContext *econtext = node->ioss_RuntimeContext;
ResetExprContext(econtext);
ExecIndexEvalRuntimeKeys(econtext,
node->ioss_RuntimeKeys,
node->ioss_NumRuntimeKeys);
}
node->ioss_RuntimeKeysReady = true;
/* reset index scan */
if (node->ioss_ScanDesc)
{
index_rescan(node->ioss_ScanDesc,
node->ioss_ScanKeys, node->ioss_NumScanKeys,
node->ioss_OrderByKeys, node->ioss_NumOrderByKeys);
if (reset_parallel_scan && node->ioss_ScanDesc->parallel_scan)
index_parallelrescan(node->ioss_ScanDesc);
}
ExecScanReScan(&node->ss);
}
示例12: ExecBitmapIndexReScan
/* ----------------------------------------------------------------
* ExecBitmapIndexReScan(node)
*
* Recalculates the value of the scan keys whose value depends on
* information known at runtime and rescans the indexed relation.
* ----------------------------------------------------------------
*/
void
ExecBitmapIndexReScan(BitmapIndexScanState *node, ExprContext *exprCtxt)
{
ExprContext *econtext;
ExprState **runtimeKeyInfo;
econtext = node->biss_RuntimeContext; /* context for runtime keys */
runtimeKeyInfo = node->biss_RuntimeKeyInfo;
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for runtime key
* calc.
*/
if (exprCtxt != NULL)
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
/*
* Reset the runtime-key context so we don't leak memory as each outer
* tuple is scanned. Note this assumes that we will recalculate *all*
* runtime keys on each call.
*/
ResetExprContext(econtext);
}
/*
* If we are doing runtime key calculations (ie, the index keys depend on
* data from an outer scan), compute the new key values
*/
if (runtimeKeyInfo)
{
ExecIndexEvalRuntimeKeys(econtext,
runtimeKeyInfo,
node->biss_ScanKeys,
node->biss_NumScanKeys);
node->biss_RuntimeKeysReady = true;
}
/* reset index scan */
index_rescan(node->biss_ScanDesc, node->biss_ScanKeys);
if (node->odbiss_ScanDesc != NULL)
index_rescan(node->odbiss_ScanDesc, node->biss_ScanKeys);
}
示例13: BitmapTableScanPlanQualTuple
static TupleTableSlot*
BitmapTableScanPlanQualTuple(BitmapTableScanState *node)
{
EState *estate = node->ss.ps.state;
Index scanrelid = ((BitmapTableScan *) node->ss.ps.plan)->scan.scanrelid;
ExprContext *econtext = node->ss.ps.ps_ExprContext;
TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
/*
* Check if we are evaluating PlanQual for tuple of this relation.
* Additional checking is not good, but no other way for now. We could
* introduce new nodes for this case and handle IndexScan --> NewNode
* switching in Init/ReScan plan...
*/
if (estate->es_evTuple != NULL &&
estate->es_evTuple[scanrelid - 1] != NULL)
{
if (estate->es_evTupleNull[scanrelid - 1])
{
return ExecClearTuple(slot);
}
ExecStoreGenericTuple(estate->es_evTuple[scanrelid - 1], slot, false);
/* Does the tuple meet the original qual conditions? */
econtext->ecxt_scantuple = slot;
ResetExprContext(econtext);
if (!ExecQual(node->bitmapqualorig, econtext, false))
{
ExecClearTuple(slot); /* would not be returned by scan */
}
/* Flag for the next call that no more tuples */
estate->es_evTupleNull[scanrelid - 1] = true;
return slot;
}
return ExecClearTuple(slot);
}
示例14: BitmapTableScanRecheckTuple
/*
* Checks eligibility of a tuple.
*
* Note, a tuple may fail to meet visibility requirement. Moreover,
* for a lossy bitmap, we need to check for every tuple to make sure
* that it satisfies the qual.
*/
bool
BitmapTableScanRecheckTuple(BitmapTableScanState *scanState, TupleTableSlot *slot)
{
/*
* If we are using lossy info or we are required to recheck each tuple
* because of visibility or other causes, then evaluate the tuple
* eligibility.
*/
if (scanState->isLossyBitmapPage || scanState->recheckTuples)
{
ExprContext *econtext = scanState->ss.ps.ps_ExprContext;
econtext->ecxt_scantuple = slot;
ResetExprContext(econtext);
return ExecQual(scanState->bitmapqualorig, econtext, false);
}
return true;
}
示例15: CheckForAssertViolations
/*
* Check for assert violations and error out, if any.
*/
static void
CheckForAssertViolations(AssertOpState* node, TupleTableSlot* slot)
{
AssertOp* plannode = (AssertOp*) node->ps.plan;
ExprContext* econtext = node->ps.ps_ExprContext;
ResetExprContext(econtext);
List* predicates = node->ps.qual;
/* Arrange for econtext's scan tuple to be the tuple under test */
econtext->ecxt_outertuple = slot;
/*
* Run in short-lived per-tuple context while computing expressions.
*/
MemoryContext oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
StringInfoData errorString;
initStringInfo(&errorString);
ListCell *l = NULL;
Assert(list_length(predicates) == list_length(plannode->errmessage));
int violationCount = 0;
int listIndex = 0;
foreach(l, predicates)
{
ExprState *clause = (ExprState *) lfirst(l);
bool isNull = false;
Datum expr_value = ExecEvalExpr(clause, econtext, &isNull, NULL);
if (!isNull && !DatumGetBool(expr_value))
{
Value *valErrorMessage = (Value*) list_nth(plannode->errmessage,
listIndex);
Assert(NULL != valErrorMessage && IsA(valErrorMessage, String) &&
0 < strlen(strVal(valErrorMessage)));
appendStringInfo(&errorString, "%s\n", strVal(valErrorMessage));
violationCount++;
}
listIndex++;
}