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

Method Convert

r/src/altrep.cpp:775–794  ·  view source on GitHub ↗

convert the i'th string of the Array to an R string (CHARSXP)

Source from the content-addressed store, hash-verified

773
774 // convert the i'th string of the Array to an R string (CHARSXP)
775 SEXP Convert(size_t i) {
776 if (array_->IsNull(i)) {
777 return NA_STRING;
778 }
779
780 view_ = string_array_->GetView(i);
781 bool no_nul = std::find(view_.begin(), view_.end(), '\0') == view_.end();
782
783 if (no_nul) {
784 ARROW_R_DCHECK(view_.size() <= std::numeric_limits<int>::max());
785 return Rf_mkCharLenCE(view_.data(), static_cast<int>(view_.size()), CE_UTF8);
786 } else if (strip_out_nuls_) {
787 return ConvertStripNul();
788 } else {
789 Error();
790
791 // not reached
792 return R_NilValue;
793 }
794 }
795
796 // strip the nuls and then convert to R string
797 SEXP ConvertStripNul() {

Callers 2

EltMethod · 0.45
MaterializeMethod · 0.45

Calls 7

ErrorClass · 0.50
IsNullMethod · 0.45
GetViewMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected