Skip to content

Commit

Permalink
GH-41398: [R][CI] Windows job failing after R 4.4 release (#41409)
Browse files Browse the repository at this point in the history
### Rationale for this change

We can't throw warnings on cran.

### What changes are included in this PR?

Update function to match changes in libarrow added in GH-39864

### Are these changes tested?

CI
### Are there any user-facing changes?

No

* GitHub Issue: #41398

Authored-by: Jacob Wujciak-Jens <jacob@wujciak.de>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
  • Loading branch information
assignUser authored and raulcd committed May 3, 2024
1 parent 85f3edc commit e3c5060
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion r/src/extension-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ arrow::Result<std::shared_ptr<arrow::DataType>> RExtensionType::Deserialize(
return std::shared_ptr<RExtensionType>(cloned.release());
}

std::string RExtensionType::ToString() const {
std::string RExtensionType::ToString() const { return ToString(false); }

std::string RExtensionType::ToString(bool show_metadata) const {
arrow::Result<std::string> result = SafeCallIntoR<std::string>([&]() {
cpp11::environment instance = r6_instance();
cpp11::function instance_ToString(instance["ToString"]);
Expand All @@ -98,7 +100,11 @@ std::string RExtensionType::ToString() const {
// In the event of an error (e.g., we are not on the main thread
// and we are not inside RunWithCapturedR()), just call the default method
if (!result.ok()) {
#if ARROW_VERSION_MAJOR >= 16
return ExtensionType::ToString(show_metadata);
#else
return ExtensionType::ToString();
#endif
} else {
return result.ValueUnsafe();
}
Expand Down
2 changes: 2 additions & 0 deletions r/src/extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class RExtensionType : public arrow::ExtensionType {

std::string Serialize() const { return extension_metadata_; }

std::string ToString(bool show_metadata = false) const;
// wrapper for libarrow < 16
std::string ToString() const;

cpp11::sexp Convert(const std::shared_ptr<arrow::ChunkedArray>& array) const;
Expand Down

0 comments on commit e3c5060

Please sign in to comment.