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

Method ExtensionEquals

r/src/extension-impl.cpp:29–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include "./safe-call-into-r.h"
28
29bool RExtensionType::ExtensionEquals(const arrow::ExtensionType& other) const {
30 // Avoid materializing the R6 instance if at all possible
31 if (other.extension_name() != extension_name()) {
32 return false;
33 }
34
35 if (other.Serialize() == Serialize()) {
36 return true;
37 }
38
39 // With any ambiguity, we need to materialize the R6 instance and call its
40 // ExtensionEquals method. We can't do this on the non-R thread.
41 arrow::Result<bool> result = SafeCallIntoR<bool>(
42 [&]() {
43 cpp11::environment instance = r6_instance();
44 cpp11::function instance_ExtensionEquals(instance["ExtensionEquals"]);
45
46 std::shared_ptr<DataType> other_shared =
47 ValueOrStop(other.Deserialize(other.storage_type(), other.Serialize()));
48 cpp11::sexp other_r6 = cpp11::to_r6<DataType>(other_shared, "ExtensionType");
49
50 cpp11::logicals result(instance_ExtensionEquals(other_r6));
51 return cpp11::as_cpp<bool>(result);
52 },
53 "RExtensionType$ExtensionEquals()");
54
55 if (!result.ok()) {
56 throw std::runtime_error(result.status().message());
57 }
58
59 return result.ValueUnsafe();
60}
61
62std::shared_ptr<arrow::Array> RExtensionType::MakeArray(
63 std::shared_ptr<arrow::ArrayData> data) const {

Callers

nothing calls this directly

Calls 10

ValueOrStopFunction · 0.85
storage_typeMethod · 0.80
ValueUnsafeMethod · 0.80
extension_nameFunction · 0.50
SerializeFunction · 0.50
extension_nameMethod · 0.45
SerializeMethod · 0.45
DeserializeMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected