mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 03:23:37 +08:00
Refactor attribute map in Arrow slot
Refactor the function to get the attribute offset map in ArrowTupleTableSlot so that it has an inlined fast path and a slow path that initializes the map during the first call. After initalization, the fast path simply returns the map.
This commit is contained in:
parent
09e5aee285
commit
3e0daf6ad4
tsl/src/hyperstore
@ -36,15 +36,14 @@ tsl_is_compressed_tid(PG_FUNCTION_ARGS)
|
||||
* relation compared to the regular one.
|
||||
*/
|
||||
const int16 *
|
||||
arrow_slot_get_attribute_offset_map(TupleTableSlot *slot)
|
||||
arrow_slot_get_attribute_offset_map_slow(TupleTableSlot *slot)
|
||||
{
|
||||
ArrowTupleTableSlot *aslot = (ArrowTupleTableSlot *) slot;
|
||||
const TupleDesc tupdesc = slot->tts_tupleDescriptor;
|
||||
Oid relid =
|
||||
OidIsValid(slot->tts_tableOid) ? slot->tts_tableOid : TupleDescAttr(tupdesc, 0)->attrelid;
|
||||
|
||||
if (aslot->attrs_offset_map)
|
||||
return aslot->attrs_offset_map;
|
||||
Assert(aslot->attrs_offset_map == NULL);
|
||||
|
||||
Ensure(OidIsValid(relid), "invalid relation for ArrowTupleTableSlot");
|
||||
|
||||
|
@ -82,7 +82,13 @@ typedef struct ArrowTupleTableSlot
|
||||
|
||||
extern const TupleTableSlotOps TTSOpsArrowTuple;
|
||||
|
||||
extern const int16 *arrow_slot_get_attribute_offset_map(TupleTableSlot *slot);
|
||||
extern const int16 *arrow_slot_get_attribute_offset_map_slow(TupleTableSlot *slot);
|
||||
|
||||
#define arrow_slot_get_attribute_offset_map(slot) \
|
||||
((ArrowTupleTableSlot *) slot)->attrs_offset_map ? \
|
||||
((ArrowTupleTableSlot *) slot)->attrs_offset_map : \
|
||||
arrow_slot_get_attribute_offset_map_slow(slot)
|
||||
|
||||
extern TupleTableSlot *ExecStoreArrowTuple(TupleTableSlot *slot, uint16 tuple_index);
|
||||
|
||||
#define TTS_IS_ARROWTUPLE(slot) ((slot)->tts_ops == &TTSOpsArrowTuple)
|
||||
@ -321,7 +327,6 @@ ExecDecrArrowTuple(TupleTableSlot *slot, uint16 decrement)
|
||||
#define ExecStoreNextArrowTuple(slot) ExecIncrArrowTuple(slot, 1)
|
||||
#define ExecStorePreviousArrowTuple(slot) ExecDecrArrowTuple(slot, 1)
|
||||
|
||||
extern const int16 *arrow_slot_get_attribute_offset_map(TupleTableSlot *slot);
|
||||
extern bool is_compressed_col(const TupleDesc tupdesc, AttrNumber attno);
|
||||
extern const ArrowArray *arrow_slot_get_array(TupleTableSlot *slot, AttrNumber attno);
|
||||
extern void arrow_slot_set_referenced_attrs(TupleTableSlot *slot, Bitmapset *attrs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user