File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -682,21 +682,25 @@ typedef enum
682682
683683typedef struct RumScanOpaqueData
684684{
685+ /* tempCtx is used to hold consistent and ordering functions data */
685686 MemoryContext tempCtx ;
686- MemoryContext keyCtx ; /* used to hold key and entry data */
687+ /* keyCtx is used to hold key and entry data */
688+ MemoryContext keyCtx ;
687689 RumState rumstate ;
688690
689- RumScanKey * keys ; /* one per scan qualifier expr */
691+ RumScanKey * keys ; /* one per scan qualifier expr */
690692 uint32 nkeys ;
691- int norderbys ;
692693
693- RumScanEntry * entries ; /* one per index search condition */
694- RumScanEntry * sortedEntries ; /* one per index search condition */
695- int entriesIncrIndex ;
694+ RumScanEntry * entries ; /* one per index search condition */
695+ RumScanEntry * sortedEntries ; /* Sorted entries. Used in fast scan */
696+ int entriesIncrIndex ; /* used in fast scan */
696697 uint32 totalentries ;
697- uint32 allocentries ; /* allocated length of entries[] */
698+ uint32 allocentries ; /* allocated length of entries[] and
699+ sortedEntries[] */
698700
699701 Tuplesortstate * sortstate ;
702+ int norderbys ; /* Number of columns in ordering.
703+ Will be assigned to sortstate->nKeys */
700704
701705 RumKey key ;
702706 bool firstCall ;
Original file line number Diff line number Diff line change @@ -2033,6 +2033,7 @@ rumgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
20332033 RumScanOpaque so = (RumScanOpaque ) scan -> opaque ;
20342034 int64 ntids = 0 ;
20352035 bool recheck ;
2036+ RumKey key ;
20362037
20372038 /*
20382039 * Set up the scan keys, and check for unsatisfiable query.
@@ -2063,14 +2064,16 @@ rumgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
20632064 */
20642065 startScan (scan );
20652066
2067+ ItemPointerSetInvalid (& key .iptr );
2068+
20662069 for (;;)
20672070 {
20682071 CHECK_FOR_INTERRUPTS ();
20692072
2070- if (!scanGetItem (scan , & so -> key , & so -> key , & recheck ))
2073+ if (!scanGetItem (scan , & key , & key , & recheck ))
20712074 break ;
20722075
2073- tbm_add_tuples (tbm , & so -> key .iptr , 1 , recheck );
2076+ tbm_add_tuples (tbm , & key .iptr , 1 , recheck );
20742077 ntids ++ ;
20752078 }
20762079
Original file line number Diff line number Diff line change @@ -547,7 +547,7 @@ rumNewScanKey(IndexScanDesc scan)
547547 oldCtx = MemoryContextSwitchTo (so -> keyCtx );
548548
549549 /* if no scan keys provided, allocate extra EVERYTHING RumScanKey */
550- so -> keys = (RumScanKey * )
550+ so -> keys = (RumScanKey * )
551551 palloc ((Max (scan -> numberOfKeys , 1 ) + scan -> numberOfOrderBys ) *
552552 sizeof (* so -> keys ));
553553 so -> nkeys = 0 ;
You can’t perform that action at this time.
0 commit comments