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

Function TypeEquals

cpp/src/arrow/compare.cc:1494–1524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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