Skip to content

Commit

Permalink
Add new callback 'scan_flags' for table access method
Browse files Browse the repository at this point in the history
The table access method supports different features due to the different
implementation, this callback is used to indicate what the AM can do,
what features the AM can support.
  • Loading branch information
HuSen8891 committed Mar 7, 2024
1 parent 6825174 commit f8a6bf8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/backend/access/aocs/aocsam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,12 @@ aoco_getnextslot(TableScanDesc scan, ScanDirection direction, TupleTableSlot *sl
return false;
}

static int
aoco_scan_flags(Relation rel)
{
return 0;
}

static Size
aoco_parallelscan_estimate(Relation rel)
{
Expand Down Expand Up @@ -2402,6 +2408,7 @@ static TableAmRoutine ao_column_methods = {
.scan_end = aoco_endscan,
.scan_rescan = aoco_rescan,
.scan_getnextslot = aoco_getnextslot,
.scan_flags = aoco_scan_flags,

.parallelscan_estimate = aoco_parallelscan_estimate,
.parallelscan_initialize = aoco_parallelscan_initialize,
Expand Down
6 changes: 6 additions & 0 deletions src/backend/access/appendonly/appendonlyam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,12 @@ appendonly_getnextslot(TableScanDesc scan, ScanDirection direction, TupleTableSl
return false;
}

int
appendonly_scan_flags(Relation relation)
{
return 0;
}

static void
closeFetchSegmentFile(AppendOnlyFetchDesc aoFetchDesc)
{
Expand Down
1 change: 1 addition & 0 deletions src/backend/access/appendonly/appendonlyam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,7 @@ static const TableAmRoutine ao_row_methods = {
.scan_end = appendonly_endscan,
.scan_rescan = appendonly_rescan,
.scan_getnextslot = appendonly_getnextslot,
.scan_flags = appendonly_scan_flags,

.parallelscan_estimate = appendonly_parallelscan_estimate,
.parallelscan_initialize = appendonly_parallelscan_initialize,
Expand Down
6 changes: 6 additions & 0 deletions src/backend/access/heap/heapam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,12 @@ heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction,
return true;
}

int
heap_scan_flags(Relation relation)
{
return 0;
}

/*
* heap_fetch - retrieve tuple with given tid
*
Expand Down
1 change: 1 addition & 0 deletions src/backend/access/heap/heapam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2597,6 +2597,7 @@ static const TableAmRoutine heapam_methods = {

.scan_set_tidrange = heap_set_tidrange,
.scan_getnextslot_tidrange = heap_getnextslot_tidrange,
.scan_flags = heap_scan_flags,

.parallelscan_estimate = table_block_parallelscan_estimate,
.parallelscan_initialize = table_block_parallelscan_initialize,
Expand Down
1 change: 1 addition & 0 deletions src/include/access/heapam.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ extern void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid,
extern bool heap_getnextslot_tidrange(TableScanDesc sscan,
ScanDirection direction,
TupleTableSlot *slot);
extern int heap_scan_flags(Relation relation);
extern bool heap_fetch(Relation relation, Snapshot snapshot,
HeapTuple tuple, Buffer *userbuf);
extern bool heap_fetch_extended(Relation relation, Snapshot snapshot,
Expand Down
1 change: 1 addition & 0 deletions src/include/cdb/cdbappendonlyam.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ extern void appendonly_endscan(TableScanDesc scan);
extern bool appendonly_getnextslot(TableScanDesc scan,
ScanDirection direction,
TupleTableSlot *slot);
extern int appendonly_scan_flags(Relation relation);
extern AppendOnlyFetchDesc appendonly_fetch_init(
Relation relation,
Snapshot snapshot,
Expand Down

0 comments on commit f8a6bf8

Please sign in to comment.