| 1110 | |
| 1111 | |
| 1112 | void |
| 1113 | extension_rumrescan_core(IndexScanDesc scan, ScanKey scankey, int nscankeys, |
| 1114 | ScanKey orderbys, int norderbys, |
| 1115 | IndexAmRoutine *coreRoutine) |
| 1116 | { |
| 1117 | bool supportsOrderedOperatorScans = false; |
| 1118 | GetMultikeyStatusFunc multiKeyStatusFunc = NULL; |
| 1119 | CanOrderInIndexScan isIndexScanOrdered = NULL; |
| 1120 | if (GetCompositeOpClassWithProps(scan->indexRelation, |
| 1121 | &supportsOrderedOperatorScans, &multiKeyStatusFunc, |
| 1122 | &isIndexScanOrdered)) |
| 1123 | { |
| 1124 | /* Copy the scan keys to our scan */ |
| 1125 | if (scankey && scan->numberOfKeys > 0) |
| 1126 | { |
| 1127 | memmove(scan->keyData, scankey, |
| 1128 | scan->numberOfKeys * sizeof(ScanKeyData)); |
| 1129 | } |
| 1130 | if (orderbys && scan->numberOfOrderBys > 0) |
| 1131 | { |
| 1132 | memmove(scan->orderByData, orderbys, |
| 1133 | scan->numberOfOrderBys * sizeof(ScanKeyData)); |
| 1134 | } |
| 1135 | |
| 1136 | /* get the opaque scans */ |
| 1137 | DocumentDBRumIndexState *outerScanState = |
| 1138 | (DocumentDBRumIndexState *) scan->opaque; |
| 1139 | |
| 1140 | int numColumns = GetCompositeOpClassPathCount( |
| 1141 | scan->indexRelation->rd_opcoptions[0]); |
| 1142 | if (outerScanState->multiKeyStatus == IndexMultiKeyStatus_Unknown) |
| 1143 | { |
| 1144 | if (multiKeyStatusFunc != NULL) |
| 1145 | { |
| 1146 | outerScanState->multiKeyStatus = multiKeyStatusFunc(scan->indexRelation); |
| 1147 | } |
| 1148 | else |
| 1149 | { |
| 1150 | outerScanState->multiKeyStatus = |
| 1151 | CheckIndexHasArrays(scan->indexRelation, coreRoutine); |
| 1152 | } |
| 1153 | |
| 1154 | /* Check if we are producing reduced index terms in this index */ |
| 1155 | BsonGinCompositePathOptions *options = |
| 1156 | (BsonGinCompositePathOptions *) scan->indexRelation->rd_opcoptions[0]; |
| 1157 | if (options->enableCompositeReducedCorrelatedTerms && |
| 1158 | outerScanState->multiKeyStatus == IndexMultiKeyStatus_HasArrays && |
| 1159 | numColumns > 1) |
| 1160 | { |
| 1161 | /* Check if we have correlated reduced terms */ |
| 1162 | outerScanState->hasCorrelatedReducedTerms = CheckIndexHasReducedTerms( |
| 1163 | scan->indexRelation, coreRoutine); |
| 1164 | } |
| 1165 | } |
| 1166 | |
| 1167 | ScanKey innerOrderBy = NULL; |
| 1168 | int32_t nInnerorderbys = 0; |
| 1169 | innerOrderBy = orderbys; |
no test coverage detected