* GPDB: Like table_beginscan(), but first attempt to create a * scan key array from the targetList and the quals if the corresponding method * is implemented. This is an optimization needed for AOCO relations. * Otherwise, it is equivalent as passing the last two arguments as, 0, NULL. * Like table_beginscan_parallel, it will be parallel mode if parallel_scan is not NULL. */
| 1033 | * Like table_beginscan_parallel, it will be parallel mode if parallel_scan is not NULL. |
| 1034 | */ |
| 1035 | static inline TableScanDesc |
| 1036 | table_beginscan_es(Relation relation, Snapshot snapshot, |
| 1037 | int nkeys, struct ScanKeyData *key, |
| 1038 | ParallelTableScanDesc parallel_scan, |
| 1039 | struct PlanState *ps) |
| 1040 | { |
| 1041 | bool isParallel = parallel_scan != NULL; |
| 1042 | uint32 flags = SO_TYPE_SEQSCAN | |
| 1043 | SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE; |
| 1044 | |
| 1045 | /* reset snapshot if in parallel mode */ |
| 1046 | if (isParallel) |
| 1047 | { |
| 1048 | Assert(RelationGetRelid(relation) == parallel_scan->phs_relid); |
| 1049 | if (!parallel_scan->phs_snapshot_any) { |
| 1050 | /* Snapshot was serialized -- restore it */ |
| 1051 | snapshot = RestoreSnapshot((char *) parallel_scan + |
| 1052 | parallel_scan->phs_snapshot_off); |
| 1053 | RegisterSnapshot(snapshot); |
| 1054 | flags |= SO_TEMP_SNAPSHOT; |
| 1055 | } |
| 1056 | else |
| 1057 | { |
| 1058 | /* SnapshotAny passed by caller (not serialized) */ |
| 1059 | snapshot = SnapshotAny; |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | if (relation->rd_tableam->scan_begin_extractcolumns) |
| 1064 | return relation->rd_tableam->scan_begin_extractcolumns(relation, snapshot, |
| 1065 | nkeys, key, |
| 1066 | parallel_scan, |
| 1067 | ps, flags); |
| 1068 | |
| 1069 | return relation->rd_tableam->scan_begin(relation, snapshot, |
| 1070 | nkeys, key, |
| 1071 | parallel_scan, flags); |
| 1072 | } |
| 1073 | |
| 1074 | /* |
| 1075 | * Like table_beginscan(), but for scanning catalog. It'll automatically use a |
no test coverage detected