Skip to content

Commit

Permalink
Merge commit '773869c4c90aa9c59d66a052a5e3f91192792304' into pg15-mas…
Browse files Browse the repository at this point in the history
…ter-merge

Merge YB master commit 773869c titled

    [#21141,21036] YSQL: Enable remote filters for Bitmap Scans

and committed 2024-04-11T00:27:43+00:00 into YB pg15.  Since there is
only one commit being merged in from YB master since the last merge, I
will refer to it simply as "YB master".

YB pg15 initial merge refers to
55782d5.

- executor/Makefile:
  - OBJS: YB master adds nodeYbBitmapIndexscan.o; upstream PG changes
    style.
- execAmi.c:
  - includes: YB master adds nodeYbBitmapIndexscan.h include in same
    location upstream PG fa2cf164aaf91e074be653c28e035f65d80eb666 adds
    extensible.h include.  YB pg15 initial merge creates a new Yugabyte
    includes section, so move this there.
- nodeYbBitmapIndexscan.c:
  - ExecEndYbBitmapIndexScan: YB master adds this new file with
    ExecCloseScanRelation.  As before in YB pg15
    ad2fedc, upstream PG
    9ddef36278a9f676c07d0b4d9f33fa22e48ce3b5 removes
    ExecCloseScanRelation, so get rid of the logic introduced by YB
    master.
- nodeYbBitmapTablescan.c:
  - function declarations: YB master removes param currentRelation from
    CreateYbBitmapTableScanDesc.  YB pg15
    b728fbd never had that param to
    begin with.  Ignore the incoming master change.
  - YbBitmapTableNext: YB master moves some lines lower; YB pg15
    ad2fedc and
    b728fbd make adjustments to those
    lines.  Tricky merge.
  - CreateYbBitmapTableScanDesc: major merge with YB pg15
    b728fbd.  Of particular note is
    - local variable "plan" is typed YbBitmapTableScan.
    - is_internal_scan changes from false to true.
    - rs_temp_snap and rs_cblock are not set since they are not part of
      TableScanDesc.
    - switch SO_TYPE_SEQSCAN to SO_TYPE_BITMAPSCAN.
  - ExecReScanYbBitmapTableScan: YB master expands a comment for why old
    scan is set to null and sets it to null.  YB pg15
    ad2fedc already set it to null.
    Bring in the comment from master since it seems useful, but besides
    that, stick with YB pg15's version.
- indxpath.c:
  - includes: YB master adds two includes interleaved with PG includes,
    and this causes conflict with YB pg15 changes to the PG includes.
    Move those includes down to the Yugabyte includes section which was
    added by YB pg15 initial merge.
  - function declarations: YB master adds new parameter
    yb_bitmap_idx_pushdowns to four functions.  YB pg15 changes
    indentation of those functions.  Trivial merge.
  - build_index_paths
    - top comment: adjacent lines conflict between upstream PG
      1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf and YB master.
    - create_index_path calls (x4): upstream PG
      1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf removes indexclausecols
      parameter from create_index_path, conflicting with YB master which
      adds a parameter in the same location.
  - build_paths_for_OR: both YB master and
    74dfe58a5927b22c744b29534e67bfdd203ac028 change signature of
    match_clauses_to_index.  Merge for two calls.
  - match_restriction_clauses_to_index: (same as build_paths_for_OR)
  - match_join_clauses_to_index: (same as build_paths_for_OR)
  - match_eclass_clauses_to_index: (same as build_paths_for_OR)
  - match_clauses_to_index: (same as build_paths_for_OR)
  - match_clause_to_index: (same as build_paths_for_OR)
- createplan.c:
  - function declarations: YB master adds parameters (mistakenly without
    YB prefix) to some PG functions.  YB pg15 changes indentation.
  - create_bitmap_subplan: YB master adds indexpushdownquals setting
    after indexqual setting, and upstream PG
    1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf moves the setting lower.
    Move the YB setting lower as well.  Take the opportunity to detach
    it from PG code better.
- planner.c:
  - plan_cluster_use_sort: YB master adds NIL argument to
    create_index_path_call.  Adjust to the change in parameters by YB
    pg15.
- setrefs.c:
  - set_plan_refs:
    - T_YbBitmapIndexScan: YB
      pg15 ad2fedc adds extra parameter
      to fix_scan_list, so do so accordingly on top of code added by YB
      master.  Upstream PG 41efb8340877e8ffd0023bb6b2ef22ffd1ca014d adds
      extra parameter to fix_upper_expr, so add the extra argument like
      other places in the same file.
    - T_YbBitmapTableScan: YB master significantly changes this.  YB
      pg15 ad2fedc adds extra parameter
      to fix_scan_list, so do so accordingly on top of master.
- pathnode.c:
  - create_index_path:
    - top comment: adjacent lines conflict between upstream PG
      1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf and YB master.
    - signature: (same)
    - body: same upstream PG 1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf
      removes indexquals and indexqualcols settings.  YB master adds
      yb_bitmap_idx_pushdowns setting in the same location.
- ruleutils.c:
  - set_deparse_planstate: upstream PG
    6ef77cf46e81f45716ec981cb08781d426181378 changes "ps->plan" to
    "plan".  YB master adds new code with "ps->plan".  Change it to
    "plan".
  - find_param_referent: YB master removes trailing whitespace on code
    which no longer has trailing whitespace in YB pg15.  Ignore the
    incoming YB master change.
- execnodes.h:
  - BitmapIndexScanState: adjacent line conflict between YB master
    modifying biss_result line and YB pg15 modifying biss_ScanKeys line.
  - YbBitmapIndexScanState: change type of biss_ScanKeys and
    biss_ScanDesc according to how it was changed in
    BitmapIndexScanState by upstream PG
    0944ec54de389b4b8a471ca1f40f1b9d81de1f30.
- pathnodes.h:
  - IndexPath: upstream PG 1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf
    changes indexclauses and removes indexquals and indexqualcols.  YB
    master adds yb_bitmap_idx_pushdowns in the same area.
- pathnode.h:
  - create_index_path: (same as pathnode.c create_index_path signature)
- pg_dml.cc:
  - PgDml::AppendTargetPB: YB pg15
    5e6edbf removes has_system_targets_
    and is_system
    logic.  YB master adds logic to set has_regular_targets_ using
    is_system.  Bring back is_system but not has_system_targets_ from
    5e6edbf, then use it for this
    merge.
- pggate.cc:
  - PgApiImpl::DmlHasRegularTargets: again, adjacent lines conflict with
    YB pg15 5e6edbf that removes
    PgApiImpl::DmlHasSystemTargets.
- pggate.h:
  - DmlHasRegularTargets: (same)
- ybc_pggate.cc:
  - YBCPgDmlHasRegularTargets: (same)
- ybc_pggate.h:
  - YBCPgDmlHasRegularTargets: (same)
- pg_expr.cc:
  - PgColumnRef::is_system: (same as pg_dml.cc)
- pg_expr.h:
  - is_system: (same as pg_dml.cc)
- pg15_tests/test_yb_bitmap_scans.sh:
  - Update diff line numbers since YB master changes content in the
    file.
  - Only check up to line 786 of the file since, after that, the output
    is quite wrong.
  • Loading branch information
jaki committed May 15, 2024
2 parents 2b31055 + 773869c commit cd1df46
Show file tree
Hide file tree
Showing 43 changed files with 1,703 additions and 301 deletions.
53 changes: 4 additions & 49 deletions pg15_tests/test_yb_bitmap_scans.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,18 @@ failing_java_test TestPgRegressYbBitmapScans
grep_in_java_test \
"failed tests: [yb_bitmap_scans]" \
TestPgRegressYbBitmapScans
diff <(diff build/latest/postgres_build/src/test/regress/{expected,results}/yb_bitmap_scans.out) - <<EOT
288,289c288,289
diff <(diff build/latest/postgres_build/src/test/regress/{expected,results}/yb_bitmap_scans.out | head -13) - <<EOT
335,336c335,336
< Update on tenk3 (cost=6.91..11.21 rows=0 width=544) (actual rows=0 loops=1)
< -> YB Bitmap Table Scan on tenk3 (cost=6.91..11.21 rows=10 width=544) (actual rows=110 loops=1)
---
> Update on tenk3 (cost=6.91..11.21 rows=0 width=0) (actual rows=0 loops=1)
> -> YB Bitmap Table Scan on tenk3 (cost=6.91..11.21 rows=10 width=312) (actual rows=110 loops=1)
329,330c329,330
376,377c376,377
< Delete on tenk3 (cost=6.75..11.00 rows=0 width=300) (actual rows=0 loops=1)
< -> YB Bitmap Table Scan on tenk3 (cost=6.75..11.00 rows=10 width=300) (actual rows=1089 loops=1)
---
> Delete on tenk3 (cost=6.75..11.00 rows=0 width=0) (actual rows=0 loops=1)
> -> YB Bitmap Table Scan on tenk3 (cost=6.75..11.00 rows=10 width=308) (actual rows=1089 loops=1)
649,650c649,650
< --------------------------------------------------------------------------------------------------------------------------
< Sort (cost=4.73..4.74 rows=1 width=115) (actual rows=11 loops=1)
---
> ---------------------------------------------------------------------------------------------------------------------------
> Sort (cost=4.73..4.74 rows=1 width=119) (actual rows=0 loops=1)
653c653,655
< -> YB Bitmap Table Scan on pg_authid (cost=0.69..4.72 rows=1 width=115) (actual rows=11 loops=1)
---
> -> YB Bitmap Table Scan on pg_authid (cost=0.69..4.72 rows=1 width=119) (actual rows=0 loops=1)
> Recheck Cond: ((rolname ~~ 'pg_%'::text) OR (rolname ~~ 'yb_%'::text))
> Rows Removed by Index Recheck: 3
655,660c657,663
< -> BitmapOr (cost=0.69..0.69 rows=2 width=0) (actual rows=11 loops=1)
< -> Bitmap Index Scan on pg_authid_rolname_index (cost=0.00..0.35 rows=1 width=0) (actual rows=8 loops=1)
< Index Cond: ((rolname >= 'pg'::name) AND (rolname < 'ph'::name))
< -> Bitmap Index Scan on pg_authid_rolname_index (cost=0.00..0.35 rows=1 width=0) (actual rows=3 loops=1)
< Index Cond: ((rolname >= 'yb'::name) AND (rolname < 'yc'::name))
< (10 rows)
---
> Rows Removed by Filter: 15
> -> BitmapOr (cost=0.69..0.69 rows=2 width=0) (actual rows=18 loops=1)
> -> Bitmap Index Scan on pg_authid_rolname_index (cost=0.00..0.35 rows=1 width=0) (actual rows=18 loops=1)
> Index Cond: ((rolname >= 'pg'::text) AND (rolname < 'ph'::text))
> -> Bitmap Index Scan on pg_authid_rolname_index (cost=0.00..0.35 rows=1 width=0) (actual rows=18 loops=1)
> Index Cond: ((rolname >= 'yb'::text) AND (rolname < 'yc'::text))
> (13 rows)
664,677c667,669
< rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | rolpassword | rolvaliduntil
< ---------------------------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+-------------+---------------
< pg_execute_server_program | f | t | f | f | f | f | f | -1 | |
< pg_monitor | f | t | f | f | f | f | f | -1 | |
< pg_read_all_settings | f | t | f | f | f | f | f | -1 | |
< pg_read_all_stats | f | t | f | f | f | f | f | -1 | |
< pg_read_server_files | f | t | f | f | f | f | f | -1 | |
< pg_signal_backend | f | t | f | f | f | f | f | -1 | |
< pg_stat_scan_tables | f | t | f | f | f | f | f | -1 | |
< pg_write_server_files | f | t | f | f | f | f | f | -1 | |
< yb_db_admin | f | f | f | f | f | f | f | -1 | |
< yb_extension | f | t | f | f | f | f | f | -1 | |
< yb_fdw | f | t | f | f | f | f | f | -1 | |
< (11 rows)
---
> oid | rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | rolpassword | rolvaliduntil
> -----+---------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+-------------+---------------
> (0 rows)
786,788c786,788
EOT
54 changes: 43 additions & 11 deletions src/postgres/src/backend/commands/explain.c
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,9 @@ ExplainNode(PlanState *planstate, List *ancestors,
case T_BitmapIndexScan:
pname = sname = "Bitmap Index Scan";
break;
case T_YbBitmapIndexScan:
pname = sname = "Bitmap Index Scan";
break;
case T_BitmapHeapScan:
pname = sname = "Bitmap Heap Scan";
break;
Expand Down Expand Up @@ -2372,6 +2375,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
}
break;
case T_BitmapIndexScan:
case T_YbBitmapIndexScan:
{
BitmapIndexScan *bitmapindexscan = (BitmapIndexScan *) plan;
const char *indexname =
Expand Down Expand Up @@ -2721,7 +2725,13 @@ ExplainNode(PlanState *planstate, List *ancestors,
case T_BitmapIndexScan:
show_scan_qual(((BitmapIndexScan *) plan)->indexqualorig,
"Index Cond", planstate, ancestors, es);
if (IsYugaByteEnabled() && es->rpc && es->analyze)
break;
case T_YbBitmapIndexScan:
show_scan_qual(((YbBitmapIndexScan *) plan)->indexqualorig,
"Index Cond", planstate, ancestors, es);
show_scan_qual(((YbBitmapIndexScan *) plan)->yb_idx_pushdown.quals,
"Storage Index Filter", planstate, ancestors, es);
if (es->rpc && es->analyze)
show_yb_rpc_stats(planstate, es);
break;
case T_BitmapHeapScan:
Expand All @@ -2738,22 +2748,44 @@ ExplainNode(PlanState *planstate, List *ancestors,
show_tidbitmap_info((BitmapHeapScanState *) planstate, es);
break;
case T_YbBitmapTableScan:
if (((YbBitmapTableScanState *) planstate)->recheck_required)
show_scan_qual(((YbBitmapTableScan *) plan)->bitmapqualorig,
"Recheck Cond", planstate, ancestors, es);
if (((YbBitmapTableScan *) plan)->bitmapqualorig)
show_instrumentation_count("Rows Removed by Index Recheck", 2,
planstate, es);
show_scan_qual(plan->qual, "Filter", planstate, ancestors, es);
if (plan->qual)
{
YbBitmapTableScanState *bitmapscanstate =
(YbBitmapTableScanState *) planstate;
YbBitmapTableScan *bitmapplan = (YbBitmapTableScan *) plan;
List *storage_filter = bitmapscanstate->work_mem_exceeded
? bitmapplan->fallback_pushdown.quals
: bitmapplan->rel_pushdown.quals;
List *local_filter = bitmapscanstate->work_mem_exceeded
? bitmapplan->fallback_local_quals
: plan->qual;

/* Storage filters are applied first, so they are output first. */
if (bitmapscanstate->recheck_required)
show_scan_qual(bitmapplan->recheck_pushdown.quals,
"Storage Recheck Cond", planstate, ancestors,
es);
show_scan_qual(storage_filter, "Storage Filter", planstate,
ancestors, es);

if (bitmapscanstate->recheck_required)
{
show_scan_qual(bitmapplan->recheck_local_quals, "Recheck Cond",
planstate, ancestors, es);
if (bitmapplan->recheck_local_quals)
show_instrumentation_count("Rows Removed by Index Recheck",
2, planstate, es);
}

show_scan_qual(local_filter, "Filter", planstate, ancestors, es);
if (local_filter)
show_instrumentation_count("Rows Removed by Filter", 1,
planstate, es);
if (es->rpc && es->analyze)
show_yb_rpc_stats(planstate, es);
if (es->analyze)
show_ybtidbitmap_info((YbBitmapTableScanState *) planstate, es);
show_ybtidbitmap_info(bitmapscanstate, es);
break;

}
case T_SampleScan:
show_tablesample(((SampleScan *) plan)->tablesample,
planstate, ancestors, es);
Expand Down
1 change: 1 addition & 0 deletions src/postgres/src/backend/executor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ include $(top_builddir)/src/Makefile.global

OBJS = \
nodeYbBatchedNestloop.o \
nodeYbBitmapIndexscan.o \
nodeYbBitmapTablescan.o \
nodeYbSeqscan.o \
ybcExpr.o \
Expand Down
6 changes: 6 additions & 0 deletions src/postgres/src/backend/executor/execAmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

/* Yugabyte includes */
#include "pg_yb_utils.h"
#include "executor/nodeYbBitmapIndexscan.h"
#include "executor/nodeYbSeqscan.h"

static bool IndexSupportsBackwardScan(Oid indexid);
Expand Down Expand Up @@ -201,6 +202,11 @@ ExecReScan(PlanState *node)
ExecReScanBitmapIndexScan((BitmapIndexScanState *) node);
break;


case T_YbBitmapIndexScanState:
ExecReScanYbBitmapIndexScan((YbBitmapIndexScanState *) node);
break;

case T_BitmapHeapScanState:
ExecReScanBitmapHeapScan((BitmapHeapScanState *) node);
break;
Expand Down
15 changes: 15 additions & 0 deletions src/postgres/src/backend/executor/execProcnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

/* Yugabyte includes */
#include "executor/nodeYbBatchedNestloop.h"
#include "executor/nodeYbBitmapIndexscan.h"
#include "executor/nodeYbBitmapTablescan.h"
#include "executor/nodeYbSeqscan.h"
#include "pg_yb_utils.h"
Expand Down Expand Up @@ -242,6 +243,11 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
estate, eflags);
break;

case T_YbBitmapIndexScan:
result = (PlanState *) ExecInitYbBitmapIndexScan((YbBitmapIndexScan *) node,
estate, eflags);
break;

case T_BitmapHeapScan:
result = (PlanState *) ExecInitBitmapHeapScan((BitmapHeapScan *) node,
estate, eflags);
Expand Down Expand Up @@ -546,6 +552,11 @@ MultiExecProcNode(PlanState *node)
result = MultiExecBitmapIndexScan((BitmapIndexScanState *) node);
break;

case T_YbBitmapIndexScanState:
result = MultiExecYbBitmapIndexScan(
(YbBitmapIndexScanState *) node);
break;

case T_BitmapAndState:
result = MultiExecBitmapAnd((BitmapAndState *) node);
break;
Expand Down Expand Up @@ -676,6 +687,10 @@ ExecEndNode(PlanState *node)
ExecEndBitmapIndexScan((BitmapIndexScanState *) node);
break;

case T_YbBitmapIndexScanState:
ExecEndYbBitmapIndexScan((YbBitmapIndexScanState *) node);
break;

case T_BitmapHeapScanState:
ExecEndBitmapHeapScan((BitmapHeapScanState *) node);
break;
Expand Down
47 changes: 7 additions & 40 deletions src/postgres/src/backend/executor/nodeBitmapIndexscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ ExecBitmapIndexScan(PlanState *pstate)
Node *
MultiExecBitmapIndexScan(BitmapIndexScanState *node)
{
TupleBitmap bitmap;
TIDBitmap *bitmap;
IndexScanDesc scandesc;
double nTuples = 0;
bool doscan;
bool is_yb_bitmap_scan;

/* must provide our own instrumentation support */
if (node->ss.ps.instrument)
Expand All @@ -67,9 +66,6 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node)
*/
scandesc = node->biss_ScanDesc;

is_yb_bitmap_scan = IsYugaByteEnabled() &&
IsYBRelation(scandesc->indexRelation);

/*
* If we have runtime keys and they've not already been set up, do it now.
* Array keys are also treated as runtime keys; note that if ExecReScan
Expand All @@ -93,41 +89,24 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node)
*/
if (node->biss_result)
{
if (is_yb_bitmap_scan)
{
Assert(IsA(node->biss_result, YbTIDBitmap));
bitmap.ybtbm = node->biss_result;
}
else
bitmap.tbm = node->biss_result;
bitmap = node->biss_result;

node->biss_result = NULL; /* reset for next time */
}
else if (is_yb_bitmap_scan)
{
bitmap.ybtbm = yb_tbm_create(work_mem * 1024L);
}
else
{
/* XXX should we use less than work_mem for this? */
bitmap.tbm = tbm_create(work_mem * 1024L,
((BitmapIndexScan *) node->ss.ps.plan)->isshared
? node->ss.ps.state->es_query_dsa : NULL);
bitmap = tbm_create(work_mem * 1024L,
((BitmapIndexScan *) node->ss.ps.plan)->isshared
? node->ss.ps.state->es_query_dsa : NULL);
}

/*
* Get TIDs from index and insert into bitmap
*/
while (doscan)
{
/*
* For Yugabyte-based index, call the variant of index_getbitmap that
* takes a YbTIDBitmap instead of a TIDBitmap
*/
if (is_yb_bitmap_scan)
nTuples += (double) yb_index_getbitmap(scandesc, bitmap.ybtbm);
else
nTuples += (double) index_getbitmap(scandesc, bitmap.tbm);
nTuples += (double) index_getbitmap(scandesc, bitmap);

CHECK_FOR_INTERRUPTS();

Expand All @@ -143,7 +122,7 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node)
if (node->ss.ps.instrument)
InstrStopNode(node->ss.ps.instrument, nTuples);

return is_yb_bitmap_scan ? (Node *) bitmap.ybtbm : (Node *) bitmap.tbm;
return (Node *) bitmap;
}

/* ----------------------------------------------------------------
Expand Down Expand Up @@ -338,18 +317,6 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
estate->es_snapshot,
indexstate->biss_NumScanKeys);

if (IsYugaByteEnabled())
{
if (IsYBRelation(indexstate->biss_RelationDesc))
indexstate->ss.ss_currentRelation =
ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);

indexstate->biss_ScanDesc->heapRelation =
indexstate->ss.ss_currentRelation;
indexstate->biss_ScanDesc->yb_exec_params = &estate->yb_exec_params;
indexstate->biss_ScanDesc->fetch_ybctids_only = true;
}

/*
* If no run-time keys to calculate, go ahead and pass the scankeys to the
* index AM.
Expand Down
41 changes: 19 additions & 22 deletions src/postgres/src/backend/executor/nodeBitmapOr.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,33 @@ MultiExecBitmapOr(BitmapOrState *node)
*/
if (IsA(subnode, BitmapIndexScanState))
{
bool is_yugabyte = IsYugaByteEnabled() &&
IsYBRelation(
((BitmapIndexScanState *) subnode)->ss.ss_currentRelation);

if (result.tbm == NULL) /* first subplan */
{
if (is_yugabyte)
result.ybtbm = yb_tbm_create(work_mem * 1024L);
else
/* XXX should we use less than work_mem for this? */
result.tbm = tbm_create(work_mem * 1024L,
((BitmapOr *) node->ps.plan)->isshared
? node->ps.state->es_query_dsa
: NULL);
/* XXX should we use less than work_mem for this? */
result.tbm = tbm_create(work_mem * 1024L,
((BitmapOr *) node->ps.plan)->isshared
? node->ps.state->es_query_dsa
: NULL);
}

if (is_yugabyte)
{
((BitmapIndexScanState *) subnode)->biss_result = result.ybtbm;
subresult.ybtbm = (YbTIDBitmap *) MultiExecProcNode(subnode);
}
else
{
((BitmapIndexScanState *) subnode)->biss_result = result.tbm;
subresult.tbm = (TIDBitmap *) MultiExecProcNode(subnode);
}
((BitmapIndexScanState *) subnode)->biss_result = result.tbm;
subresult.tbm = (TIDBitmap *) MultiExecProcNode(subnode);

if (subresult.tbm != result.tbm)
elog(ERROR, "unrecognized result from subplan");
}
/* We do the same for YbBitmapIndexScan children */
else if (IsA(subnode, YbBitmapIndexScanState))
{
if (result.ybtbm == NULL) /* first subplan */
result.ybtbm = yb_tbm_create(work_mem * 1024L);

((YbBitmapIndexScanState *) subnode)->biss_result = result.ybtbm;
subresult.ybtbm = (YbTIDBitmap *) MultiExecProcNode(subnode);

if (subresult.ybtbm != result.ybtbm)
elog(ERROR, "unrecognized result from subplan");
}
else
{
subresult.tbm = (TIDBitmap *) MultiExecProcNode(subnode);
Expand Down
Loading

0 comments on commit cd1df46

Please sign in to comment.