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

Function PrintDatum

cpp/src/arrow/compute/expression.cc:128–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126namespace {
127
128std::string PrintDatum(const Datum& datum) {
129 if (datum.is_scalar()) {
130 if (!datum.scalar()->is_valid) return "null[" + datum.type()->ToString() + "]";
131
132 switch (datum.type()->id()) {
133 case Type::STRING:
134 case Type::LARGE_STRING:
135 return '"' +
136 Escape(std::string_view(*datum.scalar_as<BaseBinaryScalar>().value)) + '"';
137
138 case Type::BINARY:
139 case Type::FIXED_SIZE_BINARY:
140 case Type::LARGE_BINARY:
141 return '"' + datum.scalar_as<BaseBinaryScalar>().value->ToHexString() + '"';
142
143 default:
144 break;
145 }
146
147 return datum.scalar()->ToString();
148 } else if (datum.is_array()) {
149 return "Array[" + datum.type()->ToString() + "]";
150 }
151 return datum.ToString();
152}
153
154} // namespace
155

Callers 3

ToStringMethod · 0.85
MakeExecBatchFunction · 0.85
AssertMethod · 0.85

Calls 8

is_scalarMethod · 0.80
ToHexStringMethod · 0.80
is_arrayMethod · 0.80
EscapeFunction · 0.50
scalarMethod · 0.45
ToStringMethod · 0.45
typeMethod · 0.45
idMethod · 0.45

Tested by 1

AssertMethod · 0.68