MCPcopy Create free account
hub / github.com/apache/cloudberry / MultiExecBitmapIndexScan

Function MultiExecBitmapIndexScan

src/backend/executor/nodeBitmapIndexscan.c:70–159  ·  view source on GitHub ↗

---------------------------------------------------------------- * MultiExecBitmapIndexScan(node) * * If IndexScanState's iss_NumArrayKeys = 0, then BitmapIndexScan * node returns a StreamBitmap that stores all the interesting rows. * The returning StreamBitmap will point to an IndexStream that contains * pointers to functions for handling the output. * * If IndexScanState's iss_NumA

Source from the content-addressed store, hash-verified

68 * ----------------------------------------------------------------
69 */
70Node *
71MultiExecBitmapIndexScan(BitmapIndexScanState *node)
72{
73 Node *bitmap = NULL;
74 IndexScanDesc scandesc;
75 double nTuples = 0;
76 bool doscan;
77
78 /* Make sure we are not leaking a previous bitmap */
79 Assert(NULL == node->biss_result);
80
81 /* must provide our own instrumentation support */
82 if (node->ss.ps.instrument)
83 InstrStartNode(node->ss.ps.instrument);
84
85 /*
86 * extract necessary information from index scan node
87 */
88 scandesc = node->biss_ScanDesc;
89
90 /*
91 * Actually the bitmap building logic is different to upstream.
92 * We build the bitmap inside function `index_getbitmap`, however,
93 * the upsteam will build the bitmap before calling `index_getbitmap`.
94 *
95 * Thus, if we want to build bitmap in cbdb, we have to pass the dsa_area
96 * into the `index_getbitmap`.
97 *
98 * I work around it by adding a field for dsa in struct IndexScanDesc,
99 * but we might need a code refaction here to align the code to upstream.
100 *
101 */
102 if (node->ss.ps.state->es_query_dsa != NULL && ((BitmapIndexScan *)node->ss.ps.plan)->isshared)
103 {
104 scandesc->dsa = node->ss.ps.state->es_query_dsa;
105 }
106
107 /*
108 * If we have runtime keys and they've not already been set up, do it now.
109 * Array keys are also treated as runtime keys; note that if ExecReScan
110 * returns with biss_RuntimeKeysReady still false, then there is an empty
111 * array key so we should do nothing.
112 */
113 if (!node->biss_RuntimeKeysReady &&
114 (node->biss_NumRuntimeKeys != 0 || node->biss_NumArrayKeys != 0))
115 {
116 ExecReScan((PlanState *) node);
117 doscan = node->biss_RuntimeKeysReady;
118
119 /* Return an empty bitmap if biss_RuntimeKeysReady still false.*/
120 if (!doscan)
121 index_initbitmap(scandesc, &bitmap);
122 }
123 else
124 doscan = true;
125
126 /* Get bitmap from index */
127 while (doscan)

Callers 2

MultiExecProcNodeFunction · 0.85

Calls 8

InstrStartNodeFunction · 0.85
ExecReScanFunction · 0.85
index_initbitmapFunction · 0.85
index_getbitmapFunction · 0.85
index_rescanFunction · 0.85
InstrStopNodeFunction · 0.85

Tested by

no test coverage detected