Revert "Fix codegen issue by moving slot_getattr to heaptuple.c similar to"

This reverts commit c940c7f6.
上级 ae90706b
......@@ -1442,41 +1442,6 @@ slot_deform_tuple(TupleTableSlot *slot, int natts)
slot->PRIVATE_tts_slow = slow;
}
/*
* Get an attribute from the tuple table slot.
*/
Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
{
Assert(!TupIsNull(slot));
Assert(attnum <= slot->tts_tupleDescriptor->natts);
/* System attribute */
if(attnum <= 0)
return slot_getsysattr(slot, attnum, isnull);
/* fast path for virtual tuple */
if(TupHasVirtualTuple(slot) && slot->PRIVATE_tts_nvalid >= attnum)
{
*isnull = slot->PRIVATE_tts_isnull[attnum-1];
return slot->PRIVATE_tts_values[attnum-1];
}
/* Mem tuple: We do not even populate virtual tuple */
if(TupHasMemTuple(slot))
{
Assert(slot->tts_mt_bind);
return memtuple_getattr(slot->PRIVATE_tts_memtuple, slot->tts_mt_bind, attnum, isnull);
}
/* Slow: heap tuple */
Assert(TupHasHeapTuple(slot));
_slot_getsomeattrs(slot, attnum);
Assert(TupHasVirtualTuple(slot) && slot->PRIVATE_tts_nvalid >= attnum);
*isnull = slot->PRIVATE_tts_isnull[attnum-1];
return slot->PRIVATE_tts_values[attnum-1];
}
/*
* slot_getsomeattrs
* This function forces the entries of the slot's Datum/isnull
......
......@@ -104,8 +104,7 @@ class SlotGetAttrCodegen : public BaseCodegen<SlotGetAttrFn> {
SlotGetAttrCodegen(gpcodegen::CodegenManager* manager,
TupleTableSlot* slot,
int max_attr)
: BaseCodegen(
manager, kSlotGetAttrPrefix, slot_getattr, &dummy_func_),
: BaseCodegen(manager, kSlotGetAttrPrefix, slot_getattr, &dummy_func_),
slot_(slot),
max_attr_(max_attr),
llvm_function_(nullptr) {
......
......@@ -316,8 +316,40 @@ static inline ItemPointer slot_get_ctid(TupleTableSlot *slot)
return &(slot->PRIVATE_tts_synthetic_ctid);
}
/* in access/common/heaptuple.c */
extern Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull);
/*
* Get an attribute from the tuple table slot.
*/
static inline Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
{
Assert(!TupIsNull(slot));
Assert(attnum <= slot->tts_tupleDescriptor->natts);
/* System attribute */
if(attnum <= 0)
return slot_getsysattr(slot, attnum, isnull);
/* fast path for virtual tuple */
if(TupHasVirtualTuple(slot) && slot->PRIVATE_tts_nvalid >= attnum)
{
*isnull = slot->PRIVATE_tts_isnull[attnum-1];
return slot->PRIVATE_tts_values[attnum-1];
}
/* Mem tuple: We do not even populate virtual tuple */
if(TupHasMemTuple(slot))
{
Assert(slot->tts_mt_bind);
return memtuple_getattr(slot->PRIVATE_tts_memtuple, slot->tts_mt_bind, attnum, isnull);
}
/* Slow: heap tuple */
Assert(TupHasHeapTuple(slot));
_slot_getsomeattrs(slot, attnum);
Assert(TupHasVirtualTuple(slot) && slot->PRIVATE_tts_nvalid >= attnum);
*isnull = slot->PRIVATE_tts_isnull[attnum-1];
return slot->PRIVATE_tts_values[attnum-1];
}
static inline bool slot_attisnull(TupleTableSlot *slot, int attnum)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册