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

Method ToString

cpp/src/arrow/scalar.cc:1000–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

998}
999
1000std::string Scalar::ToString() const {
1001 if (!this->is_valid) {
1002 return "null";
1003 }
1004 if (type->id() == Type::DICTIONARY) {
1005 auto dict_scalar = checked_cast<const DictionaryScalar*>(this);
1006 return dict_scalar->value.dictionary->ToString() + "[" +
1007 dict_scalar->value.index->ToString() + "]";
1008 }
1009 auto maybe_repr = CastTo(utf8());
1010 if (maybe_repr.ok()) {
1011 return checked_cast<const StringScalar&>(*maybe_repr.ValueOrDie()).value->ToString();
1012 }
1013
1014 std::string result;
1015 std::shared_ptr<Array> as_array = *MakeArrayFromScalar(*this, 1);
1016 DCHECK_OK(PrettyPrint(*as_array, PrettyPrintOptions::Defaults(), &result));
1017 return result;
1018}
1019
1020struct ScalarParseImpl {
1021 template <typename T, typename = internal::enable_if_parseable<T>>

Callers 9

CheckValueNotNullMethod · 0.45
VisitMethod · 0.45
ValidateValueMethod · 0.45
ValidateDenseUnionMethod · 0.45
ValidateSparseUnionMethod · 0.45
ValidateStringScalarMethod · 0.45
ValidateBinaryScalarMethod · 0.45
CastImplFunction · 0.45
PrintToFunction · 0.45

Calls 6

ValueOrDieMethod · 0.80
PrettyPrintFunction · 0.70
DefaultsFunction · 0.70
MakeArrayFromScalarFunction · 0.50
idMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected