Skip to content

Commit abb40fa

Browse files
author
Arseny Kositsyn
committed
[PGPRO-11599] Code review. Part 3.
Tags: rum
1 parent b01788e commit abb40fa

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/rumget.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,13 @@ scan_entry_cmp(const void *p1, const void *p2, void *arg)
760760
return -cmpEntries(arg, e1, e2);
761761
}
762762

763+
/*
764+
* The entryGetItem() function write the results to curItem in a specific
765+
* order. The function below allow you to understand the order in which the
766+
* results will be returned. This is important in a multi-column RUM index,
767+
* when the results will be returned in different order for different subquery
768+
* conditions.
769+
*/
763770
static bool
764771
isScanWithAltOrderKeys(RumScanOpaque so)
765772
{
@@ -1622,7 +1629,12 @@ scanGetItemRegular(IndexScanDesc scan, RumItem *advancePast,
16221629
{
16231630
RumScanEntry entry = so->entries[i];
16241631

1625-
/* In the case of scanning with altOrderKeys, skip the usual keys */
1632+
/*
1633+
* In the case of scanning with altOrderKeys, skip the usual keys.
1634+
*
1635+
* Note: so->scanWithAltOrderKeys can only be true if
1636+
* rumstate->useAlternativeOrder is true
1637+
*/
16261638
if (so->scanWithAltOrderKeys &&
16271639
rumstate->attrnAddToColumn != entry->attnumOrig)
16281640
continue;
@@ -1661,7 +1673,13 @@ scanGetItemRegular(IndexScanDesc scan, RumItem *advancePast,
16611673
RumScanKey key = so->keys[i];
16621674
int cmp;
16631675

1664-
/* In the case of scanning with altOrderKeys, skip the usual keys */
1676+
/*
1677+
* Skip orderBy keys or in the case of scanning with altOrderKeys,
1678+
* skip the usual keys.
1679+
*
1680+
* Note: so->scanWithAltOrderKeys can only be true if
1681+
* rumstate->useAlternativeOrder is true
1682+
*/
16651683
if (key->orderBy || (so->scanWithAltOrderKeys &&
16661684
rumstate->attrnAddToColumn != so->keys[i]->attnumOrig))
16671685
continue;
@@ -1692,7 +1710,13 @@ scanGetItemRegular(IndexScanDesc scan, RumItem *advancePast,
16921710
{
16931711
RumScanKey key = so->keys[i];
16941712

1695-
/* In the case of scanning with altOrderKeys, skip the usual keys */
1713+
/*
1714+
* Skip orderBy keys or in the case of scanning with altOrderKeys,
1715+
* skip the usual keys.
1716+
*
1717+
* Note: so->scanWithAltOrderKeys can only be true if
1718+
* rumstate->useAlternativeOrder is true
1719+
*/
16961720
if (key->orderBy || (so->scanWithAltOrderKeys &&
16971721
rumstate->attrnAddToColumn != so->keys[i]->attnumOrig))
16981722
continue;

0 commit comments

Comments
 (0)