MCPcopy Create free account
hub / github.com/apache/arrow / TypeEquals

Function TypeEquals

cpp/src/arrow/compare.cc:1496–1526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494}
1495
1496bool TypeEquals(const DataType& left, const DataType& right, bool check_metadata) {
1497 // The arrays are the same object
1498 if (&left == &right) {
1499 return true;
1500 } else if (left.id() != right.id()) {
1501 return false;
1502 } else {
1503 // First try to compute fingerprints
1504 if (check_metadata) {
1505 const auto& left_metadata_fp = left.metadata_fingerprint();
1506 const auto& right_metadata_fp = right.metadata_fingerprint();
1507 if (left_metadata_fp != right_metadata_fp) {
1508 return false;
1509 }
1510 }
1511
1512 const auto& left_fp = left.fingerprint();
1513 const auto& right_fp = right.fingerprint();
1514 if (!left_fp.empty() && !right_fp.empty()) {
1515 return left_fp == right_fp;
1516 }
1517
1518 // TODO remove check_metadata here?
1519 TypeEqualsVisitor visitor(right, check_metadata);
1520 auto error = VisitTypeInline(left, &visitor);
1521 if (!error.ok()) {
1522 DCHECK(false) << "Types are not comparable: " << error.ToString();
1523 }
1524 return visitor.result();
1525 }
1526}
1527
1528namespace {
1529

Callers 2

CompareArrayRangesFunction · 0.85
EqualsMethod · 0.85

Calls 6

VisitTypeInlineFunction · 0.85
idMethod · 0.45
emptyMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45
resultMethod · 0.45

Tested by

no test coverage detected