本文整理汇总了C++中TupIsNull函数的典型用法代码示例。如果您正苦于以下问题:C++ TupIsNull函数的具体用法?C++ TupIsNull怎么用?C++ TupIsNull使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TupIsNull函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecSeqScan
TupleTableSlot *
ExecSeqScan(SeqScanState *node)
{
/*
* use SeqNext as access method
*/
TupleTableSlot *slot;
if((node->scan_state & SCAN_SCAN) == 0)
OpenScanRelation(node);
slot = ExecScan((ScanState *) node, (ExecScanAccessMtd) SeqNext);
if (!TupIsNull(slot))
{
Gpmon_M_Incr_Rows_Out(GpmonPktFromSeqScanState(node));
CheckSendPlanStateGpmonPkt(&node->ps);
}
if(TupIsNull(slot) && !node->ps.delayEagerFree)
{
CloseScanRelation(node);
}
return slot;
}
示例2: DynamicScan_GetNextTuple
/*
* DynamicScan_GetNextTuple
* Gets the next tuple. If it needs to open a new relation,
* it takes care of that by asking for the next relation
* using DynamicScan_GetNextRelation.
*
* Returns the tuple fetched, or a NULL tuple
* if it exhausts all the relations/partitions.
*/
TupleTableSlot *
DynamicScan_GetNextTuple(ScanState *scanState, PartitionInitMethod *partitionInitMethod,
PartitionEndMethod *partitionEndMethod, PartitionReScanMethod *partitionReScanMethod,
PartitionScanTupleMethod *partitionScanTupleMethod)
{
TupleTableSlot *slot = NULL;
while (TupIsNull(slot) && (SCAN_SCAN == scanState->scan_state ||
SCAN_SCAN == DynamicScan_Controller(scanState, SCAN_SCAN, partitionInitMethod,
partitionEndMethod, partitionReScanMethod)))
{
slot = partitionScanTupleMethod(scanState);
if (TupIsNull(slot))
{
/* The underlying scanner should not change the scan status */
Assert(SCAN_SCAN == scanState->scan_state);
if (SCAN_DONE == DynamicScan_Controller(scanState, SCAN_NEXT, partitionInitMethod, partitionEndMethod, partitionReScanMethod) ||
SCAN_SCAN != DynamicScan_Controller(scanState, SCAN_SCAN, partitionInitMethod, partitionEndMethod, partitionReScanMethod))
{
break;
}
Assert(SCAN_SCAN == scanState->scan_state);
}
}
return slot;
}
示例3: heap_compare_slots
/*
* Compare the tuples in the two given slots.
*/
static int32
heap_compare_slots(Datum a, Datum b, void *arg)
{
GatherMergeState *node = (GatherMergeState *) arg;
SlotNumber slot1 = DatumGetInt32(a);
SlotNumber slot2 = DatumGetInt32(b);
TupleTableSlot *s1 = node->gm_slots[slot1];
TupleTableSlot *s2 = node->gm_slots[slot2];
int nkey;
Assert(!TupIsNull(s1));
Assert(!TupIsNull(s2));
for (nkey = 0; nkey < node->gm_nkeys; nkey++)
{
SortSupport sortKey = node->gm_sortkeys + nkey;
AttrNumber attno = sortKey->ssup_attno;
Datum datum1,
datum2;
bool isNull1,
isNull2;
int compare;
datum1 = slot_getattr(s1, attno, &isNull1);
datum2 = slot_getattr(s2, attno, &isNull2);
compare = ApplySortComparator(datum1, isNull1,
datum2, isNull2,
sortKey);
if (compare != 0)
return -compare;
}
return 0;
}
示例4: ExecUnique
/* ----------------------------------------------------------------
* ExecUnique
* ----------------------------------------------------------------
*/
TupleTableSlot * /* return: a tuple or NULL */
ExecUnique(UniqueState *node)
{
Unique *plannode = (Unique *) node->ps.plan;
TupleTableSlot *resultTupleSlot;
TupleTableSlot *slot;
PlanState *outerPlan;
/*
* get information from the node
*/
outerPlan = outerPlanState(node);
resultTupleSlot = node->ps.ps_ResultTupleSlot;
/*
* now loop, returning only non-duplicate tuples. We assume that the
* tuples arrive in sorted order so we can detect duplicates easily. The
* first tuple of each group is returned.
*/
for (;;)
{
/*
* fetch a tuple from the outer subplan
*/
slot = ExecProcNode(outerPlan);
if (TupIsNull(slot))
{
/* end of subplan, so we're done */
ExecClearTuple(resultTupleSlot);
return NULL;
}
/*
* Always return the first tuple from the subplan.
*/
if (TupIsNull(resultTupleSlot))
break;
/*
* Else test if the new tuple and the previously returned tuple match.
* If so then we loop back and fetch another new tuple from the
* subplan.
*/
if (!execTuplesMatch(slot, resultTupleSlot,
plannode->numCols, plannode->uniqColIdx,
node->eqfunctions,
node->tempContext))
break;
}
/*
* We have a new tuple different from the previous saved tuple (if any).
* Save it and return it. We must copy it because the source subplan
* won't guarantee that this source tuple is still accessible after
* fetching the next source tuple.
*/
return ExecCopySlot(resultTupleSlot, slot);
}
示例5: ExecDynamicTableScan
TupleTableSlot *
ExecDynamicTableScan(DynamicTableScanState *node)
{
ScanState *scanState = (ScanState *)node;
TupleTableSlot *slot = NULL;
/*
* If this is called the first time, find the pid index that contains all unique
* partition pids for this node to scan.
*/
if (node->pidIndex == NULL)
{
setPidIndex(node);
Assert(node->pidIndex != NULL);
hash_seq_init(&node->pidStatus, node->pidIndex);
node->shouldCallHashSeqTerm = true;
}
/*
* Scan the table to find next tuple to return. If the current table
* is finished, close it and open the next table for scan.
*/
while (TupIsNull(slot) &&
initNextTableToScan(node))
{
slot = ExecTableScanRelation(scanState);
#ifdef FAULT_INJECTOR
FaultInjector_InjectFaultIfSet(
FaultDuringExecDynamicTableScan,
DDLNotSpecified,
"", // databaseName
""); // tableName
#endif
if (!TupIsNull(slot))
{
Gpmon_M_Incr_Rows_Out(GpmonPktFromDynamicTableScanState(node));
CheckSendPlanStateGpmonPkt(&scanState->ps);
}
else
{
CleanupOnePartition(scanState);
}
}
return slot;
}
示例6: ExecCopySlotHeapTupleTo
/* --------------------------------
* ExecCopySlotHeadTupleTo
* Copy heapTuple to a preallocated buffer. Code adapted from ExecCopySlotTuple
*
* return the copied heaptule if there is enough space, or, if the memorycontext is
* not null, which the function will alloc enough space from the context. One can
* test if the tuple is alloced (ret == dest)
*
* return NULL and set *len to space need if there is not enough space and the mem context is null.
* return NULL if heap tuple is not valid, and set *len = 0. See slot->tts_tuple case below.
* -------------------------------
*/
HeapTuple ExecCopySlotHeapTupleTo(TupleTableSlot *slot, MemoryContext pctxt, char* dest, unsigned int *len)
{
uint32 dumlen;
HeapTuple tup = NULL;
Assert(!TupIsNull(slot));
Assert(slot->tts_tupleDescriptor);
if(!len)
len = &dumlen;
if (slot->PRIVATE_tts_heaptuple)
{
tup = heaptuple_copy_to(slot->PRIVATE_tts_heaptuple, (HeapTuple) dest, len);
if(tup || !pctxt)
return tup;
tup = (HeapTuple) ctxt_alloc(pctxt, *len);
tup = heaptuple_copy_to(slot->PRIVATE_tts_heaptuple, tup, len);
Assert(tup);
return tup;
}
slot_getallattrs(slot);
tup = heaptuple_form_to(slot->tts_tupleDescriptor, slot_get_values(slot), slot_get_isnull(slot), (HeapTuple) dest, len);
if(tup || !pctxt)
return tup;
tup = (HeapTuple) ctxt_alloc(pctxt, *len);
tup = heaptuple_form_to(slot->tts_tupleDescriptor, slot_get_values(slot), slot_get_isnull(slot), tup, len);
Assert(tup);
return tup;
}
示例7: SubqueryNext
/* ----------------------------------------------------------------
* SubqueryNext
*
* This is a workhorse for ExecSubqueryScan
* ----------------------------------------------------------------
*/
static TupleTableSlot *
SubqueryNext(SubqueryScanState *node)
{
TupleTableSlot *slot;
/*
* Get the next tuple from the sub-query.
*/
slot = ExecProcNode(node->subplan);
/*
* We just return the subplan's result slot, rather than expending extra
* cycles for ExecCopySlot(). (Our own ScanTupleSlot is used only for
* EvalPlanQual rechecks.)
*
* We do need to mark the slot contents read-only to prevent interference
* between different functions reading the same datum from the slot. It's
* a bit hokey to do this to the subplan's slot, but should be safe
* enough.
*/
if (!TupIsNull(slot))
slot = ExecMakeSlotContentsReadOnly(slot);
return slot;
}
示例8: fetch_next_tuple
static void
fetch_next_tuple(CustomScanState *node)
{
RuntimeAppendState *scan_state = (RuntimeAppendState *) node;
while (scan_state->running_idx < scan_state->ncur_plans)
{
ChildScanCommon child = scan_state->cur_plans[scan_state->running_idx];
PlanState *state = child->content.plan_state;
for (;;)
{
TupleTableSlot *slot = ExecProcNode(state);
if (TupIsNull(slot))
break;
scan_state->slot = slot;
return;
}
scan_state->running_idx++;
}
scan_state->slot = NULL;
}
示例9: ForeignNext
/* ----------------------------------------------------------------
* ForeignNext
*
* This is a workhorse for ExecForeignScan
* ----------------------------------------------------------------
*/
static TupleTableSlot *
ForeignNext(ForeignScanState *node)
{
TupleTableSlot *slot;
ForeignScan *plan = (ForeignScan *) node->ss.ps.plan;
ExprContext *econtext = node->ss.ps.ps_ExprContext;
MemoryContext oldcontext;
/* Call the Iterate function in short-lived context */
oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
slot = node->fdwroutine->IterateForeignScan(node);
MemoryContextSwitchTo(oldcontext);
/*
* If any system columns are requested, we have to force the tuple into
* physical-tuple form to avoid "cannot extract system attribute from
* virtual tuple" errors later. We also insert a valid value for
* tableoid, which is the only actually-useful system column.
*/
if (plan->fsSystemCol && !TupIsNull(slot))
{
HeapTuple tup = ExecMaterializeSlot(slot);
tup->t_tableOid = RelationGetRelid(node->ss.ss_currentRelation);
}
return slot;
}
示例10: BitmapTableScanFetchNext
/*
* Executes underlying scan method to fetch the next matching tuple.
*/
TupleTableSlot *
BitmapTableScanFetchNext(ScanState *node)
{
BitmapTableScanState *scanState = (BitmapTableScanState *) node;
TupleTableSlot *slot = BitmapTableScanPlanQualTuple(scanState);
while (TupIsNull(slot))
{
/* If we haven't already obtained the required bitmap, do so */
readBitmap(scanState);
/* If we have exhausted the current bitmap page, fetch the next one */
if (!scanState->needNewBitmapPage || fetchNextBitmapPage(scanState))
{
slot = ExecScan(&scanState->ss, (ExecScanAccessMtd) getBitmapTableScanMethod(scanState->ss.tableType)->accessMethod);
}
else
{
/*
* Needed a new bitmap page, but couldn't fetch one. Therefore,
* try the next partition.
*/
break;
}
}
return slot;
}
示例11: ExternalNext
/* ----------------------------------------------------------------
* ExternalNext
*
* This is a workhorse for ExecExtScan
* ----------------------------------------------------------------
*/
static TupleTableSlot *
ExternalNext(ExternalScanState *node)
{
HeapTuple tuple;
FileScanDesc scandesc;
Index scanrelid;
EState *estate;
ScanDirection direction;
TupleTableSlot *slot;
/*
* get information from the estate and scan state
*/
estate = node->ss.ps.state;
scandesc = node->ess_ScanDesc;
scanrelid = ((ExternalScan *) node->ss.ps.plan)->scan.scanrelid;
direction = estate->es_direction;
slot = node->ss.ss_ScanTupleSlot;
/*
* get the next tuple from the file access methods
*/
tuple = external_getnext(scandesc, direction);
/*
* save the tuple and the buffer returned to us by the access methods in
* our scan tuple slot and return the slot. Note: we pass 'false' because
* tuples returned by heap_getnext() are pointers onto disk pages and were
* not created with palloc() and so should not be pfree()'d. Note also
* that ExecStoreTuple will increment the refcount of the buffer; the
* refcount will not be dropped until the tuple table slot is cleared.
*/
if (tuple)
{
Gpmon_M_Incr_Rows_Out(GpmonPktFromExtScanState(node));
CheckSendPlanStateGpmonPkt(&node->ss.ps);
ExecStoreGenericTuple(tuple, slot, true);
/*
* CDB: Label each row with a synthetic ctid if needed for subquery dedup.
*/
if (node->cdb_want_ctid &&
!TupIsNull(slot))
{
slot_set_ctid_from_fake(slot, &node->cdb_fake_ctid);
}
}
else
{
ExecClearTuple(slot);
if (!node->ss.ps.delayEagerFree)
{
ExecEagerFreeExternalScan(node);
}
}
return slot;
}
示例12: ExecTableScan
TupleTableSlot *
ExecTableScan(TableScanState *node)
{
ScanState *scanState = (ScanState *)node;
if (scanState->scan_state == SCAN_INIT ||
scanState->scan_state == SCAN_DONE)
{
BeginTableScanRelation(scanState);
}
TupleTableSlot *slot = ExecTableScanRelation(scanState);
if (!TupIsNull(slot))
{
Gpmon_M_Incr_Rows_Out(GpmonPktFromTableScanState(node));
CheckSendPlanStateGpmonPkt(&scanState->ps);
}
else if (!scanState->ps.delayEagerFree)
{
EndTableScanRelation(scanState);
}
return slot;
}
示例13: ExecCopySlotMemTupleTo
MemTuple ExecCopySlotMemTupleTo(TupleTableSlot *slot, MemoryContext pctxt, char *dest, unsigned int *len)
{
uint32 dumlen;
MemTuple mtup = NULL;
Assert(!TupIsNull(slot));
Assert(slot->tts_mt_bind);
if(!len)
len = &dumlen;
if (TupHasMemTuple(slot))
{
mtup = memtuple_copy_to(slot->PRIVATE_tts_memtuple, slot->tts_mt_bind, (MemTuple) dest, len);
if(mtup || !pctxt)
return mtup;
mtup = (MemTuple) ctxt_alloc(pctxt, *len);
mtup = memtuple_copy_to(slot->PRIVATE_tts_memtuple, slot->tts_mt_bind, mtup, len);
Assert(mtup);
return mtup;
}
slot_getallattrs(slot);
mtup = memtuple_form_to(slot->tts_mt_bind, slot_get_values(slot), slot_get_isnull(slot), (MemTuple) dest, len, false);
if(mtup || !pctxt)
return mtup;
mtup = (MemTuple) ctxt_alloc(pctxt, *len);
mtup = memtuple_form_to(slot->tts_mt_bind, slot_get_values(slot), slot_get_isnull(slot), mtup, len, false);
Assert(mtup);
return mtup;
}
示例14: ExecDynamicIndexScan
/*
* Execution of DynamicIndexScan
*/
TupleTableSlot *
ExecDynamicIndexScan(DynamicIndexScanState *node)
{
Assert(node);
IndexScanState *indexState = &(node->indexScanState);
TupleTableSlot *slot = NULL;
/*
* If this is called the first time, find the pid index that contains all unique
* partition pids for this node to scan.
*/
if (node->pidxIndex == NULL)
{
setPidIndex(node);
Assert(node->pidxIndex != NULL);
hash_seq_init(&node->pidxStatus, node->pidxIndex);
node->shouldCallHashSeqTerm = true;
}
/*
* Scan index to find next tuple to return. If the current index
* is exhausted, close it and open the next index for scan.
*/
while (TupIsNull(slot) &&
initNextIndexToScan(node))
{
slot = ExecScan(&indexState->ss, (ExecScanAccessMtd) IndexNext);
if (!TupIsNull(slot))
{
/* Report output rows to Gpmon */
Gpmon_M_Incr_Rows_Out(GpmonPktFromDynamicIndexScanState(node));
CheckSendPlanStateGpmonPkt(&indexState->ss.ps);
}
else
{
CleanupOnePartition(indexState);
}
}
return slot;
}
示例15: ExecHash
/* ----------------------------------------------------------------
* ExecHash
*
* build hash table for hashjoin, doing partitioning if more
* than one batch is required.
* ----------------------------------------------------------------
*/
TupleTableSlot *
ExecHash(HashState *node)
{
EState *estate;
PlanState *outerNode;
List *hashkeys;
HashJoinTable hashtable;
TupleTableSlot *slot;
ExprContext *econtext;
int nbatch;
int i;
/*
* get state info from node
*/
estate = node->ps.state;
outerNode = outerPlanState(node);
hashtable = node->hashtable;
nbatch = hashtable->nbatch;
if (nbatch > 0)
{
/*
* Open temp files for inner batches, if needed. Note that file
* buffers are palloc'd in regular executor context.
*/
for (i = 0; i < nbatch; i++)
hashtable->innerBatchFile[i] = BufFileCreateTemp(false);
}
/*
* set expression context
*/
hashkeys = node->hashkeys;
econtext = node->ps.ps_ExprContext;
/*
* get all inner tuples and insert into the hash table (or temp files)
*/
for (;;)
{
slot = ExecProcNode(outerNode);
if (TupIsNull(slot))
break;
hashtable->hashNonEmpty = true;
econtext->ecxt_innertuple = slot;
ExecHashTableInsert(hashtable, econtext, hashkeys);
ExecClearTuple(slot);
}
/*
* Return the slot so that we have the tuple descriptor when we need
* to save/restore them. -Jeff 11 July 1991
*/
return slot;
}