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

Function timeUnitFromString

matlab/src/cpp/arrow/matlab/type/time_unit.cc:23–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21namespace arrow::matlab::type {
22
23arrow::Result<arrow::TimeUnit::type> timeUnitFromString(std::u16string_view unit_str) {
24 if (unit_str == u"Second") {
25 return arrow::TimeUnit::type::SECOND;
26 } else if (unit_str == u"Millisecond") {
27 return arrow::TimeUnit::type::MILLI;
28 } else if (unit_str == u"Microsecond") {
29 return arrow::TimeUnit::type::MICRO;
30 } else if (unit_str == u"Nanosecond") {
31 return arrow::TimeUnit::type::NANO;
32 } else {
33 auto maybe_utf8 = arrow::util::UTF16StringToUTF8(unit_str);
34 auto msg = maybe_utf8.ok() ? "Unknown time unit string: " + *maybe_utf8
35 : "Unknown time unit string";
36 return arrow::Status::Invalid(msg);
37 }
38}
39
40template <>
41arrow::Status validateTimeUnit<arrow::Time32Type>(arrow::TimeUnit::type unit) {

Callers

nothing calls this directly

Calls 3

UTF16StringToUTF8Function · 0.85
InvalidFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected