MCPcopy Create free account
hub / github.com/apache/cloudberry / compare_pathkeys

Function compare_pathkeys

src/backend/optimizer/path/pathkeys.c:613–645  ·  view source on GitHub ↗

* compare_pathkeys * Compare two pathkeys to see if they are equivalent, and if not whether * one is "better" than the other. * * We assume the pathkeys are canonical, and so they can be checked for * equality by simple pointer comparison. */

Source from the content-addressed store, hash-verified

611 * equality by simple pointer comparison.
612 */
613PathKeysComparison
614compare_pathkeys(List *keys1, List *keys2)
615{
616 ListCell *key1,
617 *key2;
618
619 /*
620 * Fall out quickly if we are passed two identical lists. This mostly
621 * catches the case where both are NIL, but that's common enough to
622 * warrant the test.
623 */
624 if (keys1 == keys2)
625 return PATHKEYS_EQUAL;
626
627 forboth(key1, keys1, key2, keys2)
628 {
629 PathKey *pathkey1 = (PathKey *) lfirst(key1);
630 PathKey *pathkey2 = (PathKey *) lfirst(key2);
631
632 if (pathkey1 != pathkey2)
633 return PATHKEYS_DIFFERENT; /* no need to keep looking */
634 }
635
636 /*
637 * If we reached the end of only one list, the other is longer and
638 * therefore not a subset.
639 */
640 if (key1 != NULL)
641 return PATHKEYS_BETTER1; /* key1 is longer */
642 if (key2 != NULL)
643 return PATHKEYS_BETTER2; /* key2 is longer */
644 return PATHKEYS_EQUAL;
645}
646
647/*
648 * pathkeys_contained_in

Callers 7

pathkeys_contained_inFunction · 0.85
add_paths_to_append_relFunction · 0.85
set_cheapestFunction · 0.85
add_pathFunction · 0.85
add_path_precheckFunction · 0.85
add_partial_pathFunction · 0.85

Calls 1

forbothFunction · 0.85

Tested by

no test coverage detected