Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new callback 'scan_flags' for table access method #391

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 7 additions & 0 deletions src/include/access/tableam.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,13 @@ typedef struct TableAmRoutine
ScanDirection direction,
TupleTableSlot *slot);

/*
* This callback is used to indicate what the AM can do, what features the
* AM can support, return the flags represented the supported features of
* scan.
*/
int (*scan_flags) (Relation rel);

/* ------------------------------------------------------------------------
* Parallel table scan related functions.
* ------------------------------------------------------------------------
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
Loading