代码注释 #36

Open
Lohax wants to merge 18 commits from Lohax/openGauss-server:master into master
1 changed files with 29 additions and 0 deletions
Showing only changes of commit 4be53ccd0e - Show all commits

View File

@ -415,13 +415,41 @@ void SeqScan_Init(TableScanDesc scan, SeqScanAccessor* p_accessor, Relation rela
SeqScan_Pref_Quantity(scan, p_accessor, relation);
}
/* -----------------------------------------------------------------
* reset_scan_qual
* -----------------------------------------------------------------
* Param:
* curr_heap_rel: current realation stored in heap storage
* node: ScanState type structure which indicates the scanning status
* isRangeScanInRedis: if it is a range scan in the redistribution process
* -----------------------------------------------------------------
* Note:
* This code basically returns a RangeScanInRedis structure, which
* stores three fields.You can see the specific comments in the
* struct definition.
*
* First, if node is empty, the plain value is returned. Then,
* if the cluster size is allowed and the relation is in
* redistribution process,the init function gets the new qual and
* selects a different qual based on whether or not the node is
* vectorized reading (call ExecInitVecExpr if ScanBatch, Otherwise
* call ExecInitExpr); If the qual field in node has not been
* initialized, different qual initialization functions are called
* according to whether the node is reading vectorized (ExecInitVecExpr
* is called if it is canBatch, and ExecInitExpr is called Sotherwise).
* Concatenate rangeScanInRedis to the plain value. Finally return
* node->rangeScanInRedis.
* -----------------------------------------------------------------
*/
RangeScanInRedis reset_scan_qual(Relation curr_heap_rel, ScanState* node, bool isRangeScanInRedis)
{
if (node == NULL) {
return {isRangeScanInRedis, 0, 0};
}
/* if the cluster size is allowed and the relation is in redistribution process */
if (u_sess->attr.attr_sql.enable_cluster_resize && RelationInRedistribute(curr_heap_rel)) {
List* new_qual = eval_ctid_funcs(curr_heap_rel, node->ps.plan->qual, &node->rangeScanInRedis);
/* select a different Init function depending on whether it is ScanBatch */
if (!node->scanBatchMode) {
node->ps.qual = (List*)ExecInitExpr((Expr*)new_qual, (PlanState*)&node->ps);
} else {
@ -429,6 +457,7 @@ RangeScanInRedis reset_scan_qual(Relation curr_heap_rel, ScanState* node, bool i
}
node->ps.qual_is_inited = true;
} else if (!node->ps.qual_is_inited) {
/* select a different Init function depending on whether it is ScanBatch */
if (!node->scanBatchMode) {
node->ps.qual = (List*)ExecInitExpr((Expr*)node->ps.plan->qual, (PlanState*)&node->ps);
} else {