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

Function ToString

cpp/src/gandiva/node.h:67–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 bool is_null() const { return is_null_; }
66
67 std::string ToString() const override {
68 std::stringstream ss;
69 if (return_type_ == NULLPTR) {
70 ss << "(const untyped) " << gandiva::ToString(holder_);
71 return ss.str();
72 }
73
74 ss << "(const " << return_type()->ToString() << ") ";
75 if (is_null()) {
76 ss << std::string("null");
77 return ss.str();
78 }
79
80 if (return_type()->id() == arrow::Type::STRING ||
81 return_type()->id() == arrow::Type::LARGE_STRING) {
82 ss << "'" << gandiva::ToString(holder_) << "'";
83 } else {
84 ss << gandiva::ToString(holder_);
85 }
86 // The default formatter prints in decimal can cause a loss in precision. so,
87 // print in hex. Can't use hexfloat since gcc 4.9 doesn't support it.
88 if (return_type()->id() == arrow::Type::DOUBLE) {
89 double dvalue = std::get<double>(holder_);
90 uint64_t bits;
91 memcpy(&bits, &dvalue, sizeof(bits));
92 ss << " raw(" << std::hex << bits << ")";
93 } else if (return_type()->id() == arrow::Type::FLOAT) {
94 float fvalue = std::get<float>(holder_);
95 uint32_t bits;
96 memcpy(&bits, &fvalue, sizeof(bits));
97 ss << " raw(" << std::hex << bits << ")";
98 }
99 return ss.str();
100 }
101
102 private:
103 LiteralHolder holder_;

Callers 1

VisitMethod · 0.70

Calls 11

return_typeFunction · 0.85
childrenFunction · 0.85
expr_typeFunction · 0.85
strMethod · 0.80
is_nullFunction · 0.70
fieldFunction · 0.50
ToStringMethod · 0.45
idMethod · 0.45
typeMethod · 0.45
nameMethod · 0.45
return_typeMethod · 0.45

Tested by

no test coverage detected