MCPcopy Create free account
hub / github.com/apache/impala / PrintValue

Method PrintValue

be/src/runtime/raw-value.cc:93–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void RawValue::PrintValue(const void* value, const ColumnType& type, int scale,
94 string* str) {
95 if (value == NULL) {
96 *str = NullLiteral(true);
97 return;
98 }
99
100 const StringValue* string_val = NULL;
101 bool val;
102 string tmp;
103
104 // Special case types that we can print more efficiently without using a stringstream
105 switch (type.type) {
106 case TYPE_BOOLEAN:
107 val = *reinterpret_cast<const bool*>(value);
108 *str = (val ? "true" : "false");
109 return;
110 case TYPE_STRING:
111 case TYPE_VARCHAR:
112 string_val = reinterpret_cast<const StringValue*>(value);
113 tmp.assign(string_val->Ptr(), string_val->Len());
114 str->swap(tmp);
115 return;
116 case TYPE_CHAR:
117 *str = string(reinterpret_cast<const char*>(value), type.len);
118 return;
119 case TYPE_TIMESTAMP:
120 *str = reinterpret_cast<const TimestampValue*>(value)->ToString();
121 return;
122 case TYPE_DATE:
123 *str = reinterpret_cast<const DateValue*>(value)->ToString();
124 return;
125 default:
126 break;
127 }
128
129 stringstream out;
130 out.precision(ASCII_PRECISION);
131
132 PrintValue(value, type, scale, &out);
133
134 *str = out.str();
135}
136
137void RawValue::WriteNonNullPrimitive(const void* value, void* dst, const ColumnType& type,
138 MemPool* pool) {

Callers

nothing calls this directly

Calls 13

PrintValueFunction · 0.85
isinfFunction · 0.85
Utf8SafeCEscapeFunction · 0.85
flagsMethod · 0.80
GetByteSizeMethod · 0.80
NullLiteralClass · 0.50
PtrMethod · 0.45
LenMethod · 0.45
swapMethod · 0.45
ToStringMethod · 0.45
strMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected