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

Method toString

matlab/src/cpp/arrow/matlab/array/proxy/array.cc:51–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49std::shared_ptr<arrow::Array> Array::unwrap() { return array; }
50
51void Array::toString(libmexclass::proxy::method::Context& context) {
52 ::matlab::data::ArrayFactory factory;
53
54 auto opts = arrow::PrettyPrintOptions::Defaults();
55 opts.window = 3;
56 opts.indent = 4;
57 opts.indent_size = 4;
58
59 const auto type_id = array->type()->id();
60 if (arrow::is_primitive(type_id) || arrow::is_string(type_id)) {
61 /*
62 * Display primitive and string types horizontally without
63 * opening and closing delimiters. Use " | " as the delimiter
64 * between elements. Below is an example Int32Array display:
65 *
66 * 1 | 2 | 3 | ... | 6 | 7 | 8
67 */
68 opts.skip_new_lines = true;
69 opts.array_delimiters.open = "";
70 opts.array_delimiters.close = "";
71 opts.array_delimiters.element = " | ";
72 }
73
74 std::stringstream ss;
75 MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(arrow::PrettyPrint(*array, opts, &ss), context,
76 error::ARRAY_PRETTY_PRINT_FAILED);
77
78 const auto str_utf8 = opts.skip_new_lines ? " " + ss.str() : ss.str();
79
80 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto str_utf16,
81 arrow::util::UTF8StringToUTF16(str_utf8), context,
82 error::UNICODE_CONVERSION_ERROR_ID);
83 auto str_mda = factory.createScalar(str_utf16);
84 context.outputs[0] = str_mda;
85}
86
87void Array::getNumElements(libmexclass::proxy::method::Context& context) {
88 ::matlab::data::ArrayFactory factory;

Callers 7

_from_jvm_float_typeFunction · 0.45
_from_jvm_time_typeFunction · 0.45
_from_jvm_timestamp_typeFunction · 0.45
_from_jvm_date_typeFunction · 0.45
fieldFunction · 0.45
arrayFunction · 0.45
GetArrowTypeFunction · 0.45

Calls 7

strMethod · 0.80
DefaultsFunction · 0.50
is_primitiveFunction · 0.50
is_stringFunction · 0.50
PrettyPrintFunction · 0.50
idMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected