* Compare ORDER BY expression values. */
| 406 | * Compare ORDER BY expression values. |
| 407 | */ |
| 408 | static int |
| 409 | cmp_orderbyvals(const Datum *adist, const bool *anulls, |
| 410 | const Datum *bdist, const bool *bnulls, |
| 411 | IndexScanState *node) |
| 412 | { |
| 413 | int i; |
| 414 | int result; |
| 415 | |
| 416 | for (i = 0; i < node->iss_NumOrderByKeys; i++) |
| 417 | { |
| 418 | SortSupport ssup = &node->iss_SortSupport[i]; |
| 419 | |
| 420 | /* |
| 421 | * Handle nulls. We only need to support NULLS LAST ordering, because |
| 422 | * match_pathkeys_to_index() doesn't consider indexorderby |
| 423 | * implementation otherwise. |
| 424 | */ |
| 425 | if (anulls[i] && !bnulls[i]) |
| 426 | return 1; |
| 427 | else if (!anulls[i] && bnulls[i]) |
| 428 | return -1; |
| 429 | else if (anulls[i] && bnulls[i]) |
| 430 | return 0; |
| 431 | |
| 432 | result = ssup->comparator(adist[i], bdist[i], ssup); |
| 433 | if (result != 0) |
| 434 | return result; |
| 435 | } |
| 436 | |
| 437 | return 0; |
| 438 | } |
| 439 | |
| 440 | /* |
| 441 | * Pairing heap provides getting topmost (greatest) element while KNN provides |
no outgoing calls
no test coverage detected