您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DatumGetUInt32函数代码示例

51自学网 2021-06-01 20:25:30
  C++
这篇教程C++ DatumGetUInt32函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DatumGetUInt32函数的典型用法代码示例。如果您正苦于以下问题:C++ DatumGetUInt32函数的具体用法?C++ DatumGetUInt32怎么用?C++ DatumGetUInt32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DatumGetUInt32函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: make_text_key

/* * Construct a jsonb_ops GIN key from a flag byte and a textual representation * (which need not be null-terminated).  This function is responsible * for hashing overlength text representations; it will add the * JGINFLAG_HASHED bit to the flag value if it does that. */static Datummake_text_key(char flag, const char *str, int len){	text	   *item;	char		hashbuf[10];	if (len > JGIN_MAXLENGTH)	{		uint32		hashval;		hashval = DatumGetUInt32(hash_any((const unsigned char *) str, len));		snprintf(hashbuf, sizeof(hashbuf), "%08x", hashval);		str = hashbuf;		len = 8;		flag |= JGINFLAG_HASHED;	}	/*	 * Now build the text Datum.  For simplicity we build a 4-byte-header	 * varlena text Datum here, but we expect it will get converted to short	 * header format when stored in the index.	 */	item = (text *) palloc(VARHDRSZ + len + 1);	SET_VARSIZE(item, VARHDRSZ + len + 1);	*VARDATA(item) = flag;	memcpy(VARDATA(item) + 1, str, len);	return PointerGetDatum(item);}
开发者ID:eubide,项目名称:postgres,代码行数:37,


示例2: build_hash_key

static uint32build_hash_key(const void *key, Size keysize __attribute__((unused))){    Assert(key);    BMBuildHashKey *keyData = (BMBuildHashKey*)key;	Datum *k = keyData->attributeValueArr;	bool *isNull = keyData->isNullArr;	int i;	uint32 hashkey = 0;	for(i = 0; i < cur_bmbuild->natts; i++)	{		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);        if ( isNull[i] && cur_bmbuild->hash_func_is_strict[i])        {            /* leave hashkey unmodified, equivalent to hashcode 0 */        }        else        {            hashkey ^= DatumGetUInt32(FunctionCall1(&cur_bmbuild->hash_funcs[i], k[i]));        }	}	return hashkey;}
开发者ID:AnLingm,项目名称:gpdb,代码行数:29,


示例3: ResourceArrayAdd

/* * Add a resource to ResourceArray * * Caller must have previously done ResourceArrayEnlarge() */static voidResourceArrayAdd(ResourceArray *resarr, Datum value){	uint32		idx;	Assert(value != resarr->invalidval);	Assert(resarr->nitems < resarr->maxitems);	if (RESARRAY_IS_ARRAY(resarr))	{		/* Append to linear array. */		idx = resarr->nitems;	}	else	{		/* Insert into first free slot at or after hash location. */		uint32		mask = resarr->capacity - 1;		idx = DatumGetUInt32(hash_any((void *) &value, sizeof(value))) & mask;		for (;;)		{			if (resarr->itemsarr[idx] == resarr->invalidval)				break;			idx = (idx + 1) & mask;		}	}	resarr->lastidx = idx;	resarr->itemsarr[idx] = value;	resarr->nitems++;}
开发者ID:adityavs,项目名称:postgres,代码行数:35,


示例4: mcxt_ptr_hash_std

uint32mcxt_ptr_hash_std(const void *key, Size keysize){    uint32 hashval;    hashval = DatumGetUInt32(hash_any(key, keysize));    return hashval;}
开发者ID:nextgis-borsch,项目名称:postgis,代码行数:7,


示例5: CatalogCacheComputeHashValue

/* *		CatalogCacheComputeHashValue * * Compute the hash value associated with a given set of lookup keys */static uint32CatalogCacheComputeHashValue(CatCache *cache, int nkeys, ScanKey cur_skey){	uint32		hashValue = 0;	uint32		oneHash;	CACHE4_elog(DEBUG2, "CatalogCacheComputeHashValue %s %d %p",				cache->cc_relname,				nkeys,				cache);	switch (nkeys)	{		case 4:			oneHash =				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[3],												   cur_skey[3].sk_argument));			hashValue ^= oneHash << 24;			hashValue ^= oneHash >> 8;			/* FALLTHROUGH */		case 3:			oneHash =				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[2],												   cur_skey[2].sk_argument));			hashValue ^= oneHash << 16;			hashValue ^= oneHash >> 16;			/* FALLTHROUGH */		case 2:			oneHash =				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[1],												   cur_skey[1].sk_argument));			hashValue ^= oneHash << 8;			hashValue ^= oneHash >> 24;			/* FALLTHROUGH */		case 1:			oneHash =				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[0],												   cur_skey[0].sk_argument));			hashValue ^= oneHash;			break;		default:			elog(FATAL, "wrong number of hash keys: %d", nkeys);			break;	}	return hashValue;}
开发者ID:gavioto,项目名称:tPostgres,代码行数:52,


示例6: ResourceArrayRemove

/* * Remove a resource from ResourceArray * * Returns true on success, false if resource was not found. * * Note: if same resource ID appears more than once, one instance is removed. */static boolResourceArrayRemove(ResourceArray *resarr, Datum value){	uint32		i,				idx,				lastidx = resarr->lastidx;	Assert(value != resarr->invalidval);	/* Search through all items, but try lastidx first. */	if (RESARRAY_IS_ARRAY(resarr))	{		if (lastidx < resarr->nitems &&			resarr->itemsarr[lastidx] == value)		{			resarr->itemsarr[lastidx] = resarr->itemsarr[resarr->nitems - 1];			resarr->nitems--;			/* Update lastidx to make reverse-order removals fast. */			resarr->lastidx = resarr->nitems - 1;			return true;		}		for (i = 0; i < resarr->nitems; i++)		{			if (resarr->itemsarr[i] == value)			{				resarr->itemsarr[i] = resarr->itemsarr[resarr->nitems - 1];				resarr->nitems--;				/* Update lastidx to make reverse-order removals fast. */				resarr->lastidx = resarr->nitems - 1;				return true;			}		}	}	else	{		uint32		mask = resarr->capacity - 1;		if (lastidx < resarr->capacity &&			resarr->itemsarr[lastidx] == value)		{			resarr->itemsarr[lastidx] = resarr->invalidval;			resarr->nitems--;			return true;		}		idx = DatumGetUInt32(hash_any((void *) &value, sizeof(value))) & mask;		for (i = 0; i < resarr->capacity; i++)		{			if (resarr->itemsarr[idx] == value)			{				resarr->itemsarr[idx] = resarr->invalidval;				resarr->nitems--;				return true;			}			idx = (idx + 1) & mask;		}	}	return false;}
开发者ID:adityavs,项目名称:postgres,代码行数:66,


示例7: TupleHashTableHash

/* * Compute the hash value for a tuple * * The passed-in key is a pointer to TupleHashEntryData.  In an actual hash * table entry, the firstTuple field points to a tuple (in MinimalTuple * format).  LookupTupleHashEntry sets up a dummy TupleHashEntryData with a * NULL firstTuple field --- that cues us to look at the inputslot instead. * This convention avoids the need to materialize virtual input tuples unless * they actually need to get copied into the table. * * Also, the caller must select an appropriate memory context for running * the hash functions. (dynahash.c doesn't change CurrentMemoryContext.) */static uint32TupleHashTableHash(struct tuplehash_hash *tb, const MinimalTuple tuple){	TupleHashTable hashtable = (TupleHashTable) tb->private_data;	int			numCols = hashtable->numCols;	AttrNumber *keyColIdx = hashtable->keyColIdx;	uint32		hashkey = hashtable->hash_iv;	TupleTableSlot *slot;	FmgrInfo   *hashfunctions;	int			i;	if (tuple == NULL)	{		/* Process the current input tuple for the table */		slot = hashtable->inputslot;		hashfunctions = hashtable->in_hash_funcs;	}	else	{		/*		 * Process a tuple already stored in the table.		 *		 * (this case never actually occurs due to the way simplehash.h is		 * used, as the hash-value is stored in the entries)		 */		slot = hashtable->tableslot;		ExecStoreMinimalTuple(tuple, slot, false);		hashfunctions = hashtable->tab_hash_funcs;	}	for (i = 0; i < numCols; i++)	{		AttrNumber	att = keyColIdx[i];		Datum		attr;		bool		isNull;		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);		attr = slot_getattr(slot, att, &isNull);		if (!isNull)			/* treat nulls as having hash key 0 */		{			uint32		hkey;			hkey = DatumGetUInt32(FunctionCall1(&hashfunctions[i],												attr));			hashkey ^= hkey;		}	}	/*	 * The way hashes are combined above, among each other and with the IV,	 * doesn't lead to good bit perturbation. As the IV's goal is to lead to	 * achieve that, perform a round of hashing of the combined hash -	 * resulting in near perfect perturbation.	 */	return murmurhash32(hashkey);}
开发者ID:adityavs,项目名称:postgres,代码行数:72,


示例8: lexeme_hash

/* * Hash functions for lexemes. They are strings, but not NULL terminated, * so we need a special hash function. */static uint32lexeme_hash(const void *key, Size keysize){	const LexemeHashKey *l = (const LexemeHashKey *) key;	return DatumGetUInt32(hash_any((const unsigned char *) l->lexeme,								   l->length));}
开发者ID:eubide,项目名称:postgres,代码行数:12,


示例9: element_hash

/* * Hash function for elements. * * We use the element type's default hash opclass, and the default collation * if the type is collation-sensitive. */static uint32element_hash(const void *key, Size keysize){	Datum		d = *((const Datum *) key);	Datum		h;	h = FunctionCall1Coll(array_extra_data->hash, DEFAULT_COLLATION_OID, d);	return DatumGetUInt32(h);}
开发者ID:EccentricLoggers,项目名称:peloton,代码行数:15,


示例10: _hash_datum2hashkey

/* * _hash_datum2hashkey -- given a Datum, call the index's hash procedure * * The Datum is assumed to be of the index's column type, so we can use the * "primary" hash procedure that's tracked for us by the generic index code. */uint32_hash_datum2hashkey(Relation rel, Datum key){	FmgrInfo   *procinfo;	/* XXX assumes index has only one attribute */	procinfo = index_getprocinfo(rel, 1, HASHPROC);	return DatumGetUInt32(FunctionCall1(procinfo, key));}
开发者ID:AnLingm,项目名称:gpdb,代码行数:16,


示例11: pgss_hash_fn

/* * Calculate hash value for a key */static uint32pgss_hash_fn(const void *key, Size keysize){	const pgssHashKey *k = (const pgssHashKey *) key;	/* we don't bother to include encoding in the hash */	return hash_uint32((uint32) k->userid) ^		hash_uint32((uint32) k->dbid) ^		DatumGetUInt32(hash_any((const unsigned char *) k->query_ptr,								k->query_len));}
开发者ID:HBPSP8Repo,项目名称:NoDB,代码行数:14,


示例12: _hash_datum2hashkey

/* * _hash_datum2hashkey -- given a Datum, call the index's hash procedure * * The Datum is assumed to be of the index's column type, so we can use the * "primary" hash procedure that's tracked for us by the generic index code. */uint32_hash_datum2hashkey(Relation rel, Datum key){	FmgrInfo   *procinfo;	Oid			collation;	/* XXX assumes index has only one attribute */	procinfo = index_getprocinfo(rel, 1, HASHPROC);	collation = rel->rd_indcollation[0];	return DatumGetUInt32(FunctionCall1Coll(procinfo, collation, key));}
开发者ID:AlexHill,项目名称:postgres,代码行数:18,


示例13: TupleHashTableHash

/* * Compute the hash value for a tuple * * The passed-in key is a pointer to TupleHashEntryData.  In an actual hash * table entry, the firstTuple field points to a tuple (in MinimalTuple * format).  LookupTupleHashEntry sets up a dummy TupleHashEntryData with a * NULL firstTuple field --- that cues us to look at the inputslot instead. * This convention avoids the need to materialize virtual input tuples unless * they actually need to get copied into the table. * * Also, the caller must select an appropriate memory context for running * the hash functions. (dynahash.c doesn't change CurrentMemoryContext.) */static uint32TupleHashTableHash(struct tuplehash_hash *tb, const MinimalTuple tuple){	TupleHashTable hashtable = (TupleHashTable) tb->private_data;	int			numCols = hashtable->numCols;	AttrNumber *keyColIdx = hashtable->keyColIdx;	uint32		hashkey = hashtable->hash_iv;	TupleTableSlot *slot;	FmgrInfo   *hashfunctions;	int			i;	if (tuple == NULL)	{		/* Process the current input tuple for the table */		slot = hashtable->inputslot;		hashfunctions = hashtable->in_hash_funcs;	}	else	{		/*		 * Process a tuple already stored in the table.		 *		 * (this case never actually occurs due to the way simplehash.h is		 * used, as the hash-value is stored in the entries)		 */		slot = hashtable->tableslot;		ExecStoreMinimalTuple(tuple, slot, false);		hashfunctions = hashtable->tab_hash_funcs;	}	for (i = 0; i < numCols; i++)	{		AttrNumber	att = keyColIdx[i];		Datum		attr;		bool		isNull;		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);		attr = slot_getattr(slot, att, &isNull);		if (!isNull)			/* treat nulls as having hash key 0 */		{			uint32		hkey;			hkey = DatumGetUInt32(FunctionCall1(&hashfunctions[i],												attr));			hashkey ^= hkey;		}	}	return hashkey;}
开发者ID:dreamsxin,项目名称:postgresql-1,代码行数:66,


示例14: string_hash

/* * string_hash: hash function for keys that are null-terminated strings. * * NOTE: this is the default hash function if none is specified. */uint32string_hash(const void *key, Size keysize){	/*	 * If the string exceeds keysize-1 bytes, we want to hash only that many,	 * because when it is copied into the hash table it will be truncated at	 * that length.	 */	Size		s_len = strlen((const char *) key);	s_len = Min(s_len, keysize - 1);	return DatumGetUInt32(hash_any((const unsigned char *) key,								   (int) s_len));}
开发者ID:KMU-embedded,项目名称:mosbench-ext,代码行数:19,


示例15: TupleHashTableHash

/* * Compute the hash value for a tuple * * The passed-in key is a pointer to TupleHashEntryData.  In an actual hash * table entry, the firstTuple field points to a tuple (in MinimalTuple * format).  LookupTupleHashEntry sets up a dummy TupleHashEntryData with a * NULL firstTuple field --- that cues us to look at the inputslot instead. * This convention avoids the need to materialize virtual input tuples unless * they actually need to get copied into the table. * * CurTupleHashTable must be set before calling this, since dynahash.c * doesn't provide any API that would let us get at the hashtable otherwise. * * Also, the caller must select an appropriate memory context for running * the hash functions. (dynahash.c doesn't change CurrentMemoryContext.) */static uint32TupleHashTableHash(const void *key, Size keysize){	MinimalTuple tuple = ((const TupleHashEntryData *) key)->firstTuple;	TupleTableSlot *slot;	TupleHashTable hashtable = CurTupleHashTable;	int			numCols = hashtable->numCols;	AttrNumber *keyColIdx = hashtable->keyColIdx;	FmgrInfo   *hashfunctions;	uint32		hashkey = 0;	int			i;	if (tuple == NULL)	{		/* Process the current input tuple for the table */		slot = hashtable->inputslot;		hashfunctions = hashtable->in_hash_funcs;	}	else	{		/* Process a tuple already stored in the table */		/* (this case never actually occurs in current dynahash.c code) */		slot = hashtable->tableslot;		ExecStoreMinimalTuple(tuple, slot, false);		hashfunctions = hashtable->tab_hash_funcs;	}	for (i = 0; i < numCols; i++)	{		AttrNumber	att = keyColIdx[i];		Datum		attr;		bool		isNull;		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);		attr = slot_getattr(slot, att, &isNull);		if (!isNull)			/* treat nulls as having hash key 0 */		{			uint32		hkey;			hkey = DatumGetUInt32(FunctionCall1(&hashfunctions[i],												attr));			hashkey ^= hkey;		}	}	return hashkey;}
开发者ID:HyukjinKwon,项目名称:pipelinedb,代码行数:66,


示例16: bernoulli_nextsampletuple

/* * Select next sampled tuple in current block. * * It is OK here to return an offset without knowing if the tuple is visible * (or even exists).  The reason is that we do the coinflip for every tuple * offset in the table.  Since all tuples have the same probability of being * returned, it doesn't matter if we do extra coinflips for invisible tuples. * * When we reach end of the block, return InvalidOffsetNumber which tells * SampleScan to go to next block. */static OffsetNumberbernoulli_nextsampletuple(SampleScanState *node,						  BlockNumber blockno,						  OffsetNumber maxoffset){	BernoulliSamplerData *sampler = (BernoulliSamplerData *) node->tsm_state;	OffsetNumber tupoffset = sampler->lt;	uint32		hashinput[3];	/* Advance to first/next tuple in block */	if (tupoffset == InvalidOffsetNumber)		tupoffset = FirstOffsetNumber;	else		tupoffset++;	/*	 * We compute the hash by applying hash_any to an array of 3 uint32's	 * containing the block, offset, and seed.  This is efficient to set up,	 * and with the current implementation of hash_any, it gives	 * machine-independent results, which is a nice property for regression	 * testing.	 *	 * These words in the hash input are the same throughout the block:	 */	hashinput[0] = blockno;	hashinput[2] = sampler->seed;	/*	 * Loop over tuple offsets until finding suitable TID or reaching end of	 * block.	 */	for (; tupoffset <= maxoffset; tupoffset++)	{		uint32		hash;		hashinput[1] = tupoffset;		hash = DatumGetUInt32(hash_any((const unsigned char *) hashinput,									   (int) sizeof(hashinput)));		if (hash < sampler->cutoff)			break;	}	if (tupoffset > maxoffset)		tupoffset = InvalidOffsetNumber;	sampler->lt = tupoffset;	return tupoffset;}
开发者ID:ArgenBarbie,项目名称:postgresql-9.5.0,代码行数:61,


示例17: _hash_datum2hashkey_type

/* * _hash_datum2hashkey_type -- given a Datum of a specified type, *			hash it in a fashion compatible with this index * * This is much more expensive than _hash_datum2hashkey, so use it only in * cross-type situations. */uint32_hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype){	RegProcedure hash_proc;	/* XXX assumes index has only one attribute */	hash_proc = get_opfamily_proc(rel->rd_opfamily[0],								  keytype,								  keytype,								  HASHPROC);	if (!RegProcedureIsValid(hash_proc))		elog(ERROR, "missing support function %d(%u,%u) for index /"%s/"",			 HASHPROC, keytype, keytype,			 RelationGetRelationName(rel));	return DatumGetUInt32(OidFunctionCall1(hash_proc, key));}
开发者ID:AnLingm,项目名称:gpdb,代码行数:24,


示例18: system_nextsampleblock

/* * Select next block to sample. */static BlockNumbersystem_nextsampleblock(SampleScanState *node){	SystemSamplerData *sampler = (SystemSamplerData *) node->tsm_state;	HeapScanDesc scan = node->ss.ss_currentScanDesc;	BlockNumber nextblock = sampler->nextblock;	uint32		hashinput[2];	/*	 * We compute the hash by applying hash_any to an array of 2 uint32's	 * containing the block number and seed.  This is efficient to set up, and	 * with the current implementation of hash_any, it gives	 * machine-independent results, which is a nice property for regression	 * testing.	 *	 * These words in the hash input are the same throughout the block:	 */	hashinput[1] = sampler->seed;	/*	 * Loop over block numbers until finding suitable block or reaching end of	 * relation.	 */	for (; nextblock < scan->rs_nblocks; nextblock++)	{		uint32		hash;		hashinput[0] = nextblock;		hash = DatumGetUInt32(hash_any((const unsigned char *) hashinput,									   (int) sizeof(hashinput)));		if (hash < sampler->cutoff)			break;	}	if (nextblock < scan->rs_nblocks)	{		/* Found a suitable block; remember where we should start next time */		sampler->nextblock = nextblock + 1;		return nextblock;	}	/* Done, but let's reset nextblock to 0 for safety. */	sampler->nextblock = 0;	return InvalidBlockNumber;}
开发者ID:Brar,项目名称:postgres,代码行数:49,


示例19: uint32_hash

/* * uint32_hash: hash function for keys that are uint32 or int32 * * (tag_hash works for this case too, but is slower) */uint32uint32_hash(const void *key, Size keysize){	Assert(keysize == sizeof(uint32));	return DatumGetUInt32(hash_uint32(*((const uint32 *) key)));}
开发者ID:0x0FFF,项目名称:postgres,代码行数:11,


示例20: geography_hash

/*** Calculate a hash code based on the geometry data alone*/static uint32 geography_hash(GSERIALIZED *g){	return DatumGetUInt32(hash_any((void*)g, VARSIZE(g)));}
开发者ID:NianYue,项目名称:pipelinedb,代码行数:7,


示例21: ExecDML

/* * Executes INSERT and DELETE DML operations. The * action is specified within the TupleTableSlot at * plannode->actionColIdx.The ctid of the tuple to delete * is in position plannode->ctidColIdx in the current slot. * */TupleTableSlot*ExecDML(DMLState *node){	PlanState *outerNode = outerPlanState(node);	DML *plannode = (DML *) node->ps.plan;	Assert(outerNode != NULL);	TupleTableSlot *slot = ExecProcNode(outerNode);	if (TupIsNull(slot))	{		return NULL;	}	bool isnull = false;	int action = DatumGetUInt32(slot_getattr(slot, plannode->actionColIdx, &isnull));	Assert(!isnull);	isnull = false;	Datum oid = slot_getattr(slot, plannode->oidColIdx, &isnull);	slot->tts_tableOid = DatumGetUInt32(oid);	bool isUpdate = false;	if (node->ps.state->es_plannedstmt->commandType == CMD_UPDATE)	{		isUpdate = true;	}	Assert(action == DML_INSERT || action == DML_DELETE);	/*	 * Reset per-tuple memory context to free any expression evaluation	 * storage allocated in the previous tuple cycle.	 */	ExprContext *econtext = node->ps.ps_ExprContext;	ResetExprContext(econtext);	/* Prepare cleaned-up tuple by projecting it and filtering junk columns */	econtext->ecxt_outertuple = slot;	TupleTableSlot *projectedSlot = ExecProject(node->ps.ps_ProjInfo, NULL);	/* remove 'junk' columns from tuple */	node->cleanedUpSlot = ExecFilterJunk(node->junkfilter, projectedSlot);	if (DML_INSERT == action)	{		/* Respect any given tuple Oid when updating a tuple. */		if(isUpdate &&		    plannode->tupleoidColIdx != 0)		{			isnull = false;			oid = slot_getattr(slot, plannode->tupleoidColIdx, &isnull);			HeapTuple htuple = ExecFetchSlotHeapTuple(node->cleanedUpSlot);			Assert(htuple == node->cleanedUpSlot->PRIVATE_tts_heaptuple);			HeapTupleSetOid(htuple, oid);		}		/* The plan origin is required since ExecInsert performs different actions 		 * depending on the type of plan (constraint enforcement and triggers.) 		 */		ExecInsert(node->cleanedUpSlot, NULL /* destReceiver */,				node->ps.state, PLANGEN_OPTIMIZER /* Plan origin */, 				isUpdate);	}	else /* DML_DELETE */	{		Datum ctid = slot_getattr(slot, plannode->ctidColIdx, &isnull);		Assert(!isnull);		ItemPointer  tupleid = (ItemPointer) DatumGetPointer(ctid);		ItemPointerData tuple_ctid = *tupleid;		tupleid = &tuple_ctid;		/* Correct tuple count by ignoring deletes when splitting tuples. */		ExecDelete(tupleid, node->cleanedUpSlot, NULL /* DestReceiver */, node->ps.state,				PLANGEN_OPTIMIZER /* Plan origin */, isUpdate);	}	return slot;}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:92,


示例22: FetchTableCommon

/* * FetchTableCommon executes common logic that wraps around the actual data * fetching function. This common logic includes ensuring that only one process * tries to fetch this table at any given time, and that data fetch operations * are retried in case of node failures. */static voidFetchTableCommon(text *tableNameText, uint64 remoteTableSize,				 ArrayType *nodeNameObject, ArrayType *nodePortObject,				 bool (*FetchTableFunction)(const char *, uint32, const char *)){	uint64 shardId = INVALID_SHARD_ID;	Oid relationId = InvalidOid;	List *relationNameList = NIL;	RangeVar *relation = NULL;	uint32 nodeIndex = 0;	bool tableFetched = false;	char *tableName = text_to_cstring(tableNameText);	Datum *nodeNameArray = DeconstructArrayObject(nodeNameObject);	Datum *nodePortArray = DeconstructArrayObject(nodePortObject);	int32 nodeNameCount = ArrayObjectCount(nodeNameObject);	int32 nodePortCount = ArrayObjectCount(nodePortObject);	/* we should have the same number of node names and port numbers */	if (nodeNameCount != nodePortCount)	{		ereport(ERROR, (errmsg("node name array size: %d and node port array size: %d"							   " do not match", nodeNameCount, nodePortCount)));	}	/*	 * We lock on the shardId, but do not unlock. When the function returns, and	 * the transaction for this function commits, this lock will automatically	 * be released. This ensures that concurrent caching commands will see the	 * newly created table when they acquire the lock (in read committed mode).	 */	shardId = ExtractShardId(tableName);	LockShardResource(shardId, AccessExclusiveLock);	relationNameList = textToQualifiedNameList(tableNameText);	relation = makeRangeVarFromNameList(relationNameList);	relationId = RangeVarGetRelid(relation, NoLock, true);	/* check if we already fetched the table */	if (relationId != InvalidOid)	{		uint64 localTableSize = 0;		if (!ExpireCachedShards)		{			return;		}		/*		 * Check if the cached shard has the same size on disk as it has as on		 * the placement (is up to date).		 *		 * Note 1: performing updates or deletes on the original shard leads to		 * inconsistent sizes between different databases in which case the data		 * would be fetched every time, or worse, the placement would get into		 * a deadlock when it tries to fetch from itself while holding the lock.		 * Therefore, this option is disabled by default.		 *		 * Note 2: when appending data to a shard, the size on disk only		 * increases when a new page is added (the next 8kB block).		 */		localTableSize = LocalTableSize(relationId);		if (remoteTableSize > localTableSize)		{			/* table is not up to date, drop the table */			ObjectAddress tableObject = { InvalidOid, InvalidOid, 0 };			tableObject.classId = RelationRelationId;			tableObject.objectId = relationId;			tableObject.objectSubId = 0;			performDeletion(&tableObject, DROP_RESTRICT, PERFORM_DELETION_INTERNAL);		}		else		{			/* table is up to date */			return;		}	}	/* loop until we fetch the table or try all nodes */	while (!tableFetched && (nodeIndex < nodeNameCount))	{		Datum nodeNameDatum = nodeNameArray[nodeIndex];		Datum nodePortDatum = nodePortArray[nodeIndex];		char *nodeName = TextDatumGetCString(nodeNameDatum);		uint32 nodePort = DatumGetUInt32(nodePortDatum);		tableFetched = (*FetchTableFunction)(nodeName, nodePort, tableName);		nodeIndex++;	}//.........这里部分代码省略.........
开发者ID:amosbird,项目名称:citus,代码行数:101,


示例23: hashDatum

//.........这里部分代码省略.........		case VARCHAROID: /* varchar */ 		case BYTEAOID:   /* bytea */			{				int tmplen;				varattrib_untoast_ptr_len(datum, (char **) &buf, &tmplen, &tofree);				/* adjust length to not include trailing blanks */				if (type != BYTEAOID && tmplen > 1)					tmplen = ignoreblanks((char *) buf, tmplen);				len = tmplen;				break;			}		case NAMEOID:			namebuf = DatumGetName(datum);			len = NAMEDATALEN;			buf = NameStr(*namebuf);			/* adjust length to not include trailing blanks */			if (len > 1)				len = ignoreblanks((char *) buf, len);			break;				/*		 * ====== OBJECT IDENTIFIER TYPES ======		 */		case OIDOID:				/* object identifier(oid), maximum 4 billion */		case REGPROCOID:			/* function name */		case REGPROCEDUREOID:		/* function name with argument types */		case REGOPEROID:			/* operator name */		case REGOPERATOROID:		/* operator with argument types */		case REGCLASSOID:			/* relation name */		case REGTYPEOID:			/* data type name */			intbuf = (int64) DatumGetUInt32(datum);	/* cast to 8 byte before hashing */			buf = &intbuf;			len = sizeof(intbuf);			break;        case TIDOID:                /* tuple id (6 bytes) */            buf = DatumGetPointer(datum);            len = SizeOfIptrData;            break;					/*		 * ====== DATE/TIME TYPES ======		 */		case TIMESTAMPOID:		/* date and time */			tsbuf = DatumGetTimestamp(datum);			buf = &tsbuf;			len = sizeof(tsbuf);			break;		case TIMESTAMPTZOID:	/* date and time with time zone */			tstzbuf = DatumGetTimestampTz(datum);			buf = &tstzbuf;			len = sizeof(tstzbuf);			break;		case DATEOID:			/* ANSI SQL date */			datebuf = DatumGetDateADT(datum);			buf = &datebuf;			len = sizeof(datebuf);			break;		case TIMEOID:			/* hh:mm:ss, ANSI SQL time */			timebuf = DatumGetTimeADT(datum);
开发者ID:PivotalBigData,项目名称:incubator-hawq,代码行数:67,


示例24: oid_hash

/* * oid_hash: hash function for keys that are OIDs * * (tag_hash works for this case too, but is slower) */uint32oid_hash(const void *key, Size keysize){	Assert(keysize == sizeof(Oid));	return DatumGetUInt32(hash_uint32((uint32) *((const Oid *) key)));}
开发者ID:KMU-embedded,项目名称:mosbench-ext,代码行数:11,


示例25: tag_hash

/* * tag_hash: hash function for fixed-size tag values */uint32tag_hash(const void *key, Size keysize){	return DatumGetUInt32(hash_any((const unsigned char *) key,								   (int) keysize));}
开发者ID:KMU-embedded,项目名称:mosbench-ext,代码行数:9,


示例26: string_hash

/* * string_hash: hash function for keys that are null-terminated strings. * * NOTE: this is the default hash function if none is specified. */uint32string_hash(const void *key, Size keysize){	return DatumGetUInt32(hash_any((const unsigned char *) key,								   (int) strlen((const char *) key)));}
开发者ID:berkeley-cs186,项目名称:course-fa07,代码行数:11,



注:本文中的DatumGetUInt32函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DbgAssert函数代码示例
C++ DatumGetPointer函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。