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

Method ToThrift

be/src/runtime/types.cc:220–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void ColumnType::ToThrift(TColumnType* thrift_type) const {
221 thrift_type->types.push_back(TTypeNode());
222 TTypeNode& node = thrift_type->types.back();
223 if (IsComplexType()) {
224 if (type == TYPE_ARRAY) {
225 node.type = TTypeNodeType::ARRAY;
226 } else if (type == TYPE_MAP) {
227 node.type = TTypeNodeType::MAP;
228 } else {
229 DCHECK_EQ(type, TYPE_STRUCT);
230 node.type = TTypeNodeType::STRUCT;
231 node.__set_struct_fields(vector<TStructField>());
232 DCHECK_EQ(field_names.size(), field_ids.size());
233 for (int i=0; i<field_names.size(); i++) {
234 node.struct_fields.push_back(TStructField());
235 node.struct_fields.back().name = field_names[i];
236 node.struct_fields.back().field_id = field_ids[i];
237 }
238 }
239 for (const ColumnType& child: children) {
240 child.ToThrift(thrift_type);
241 }
242 } else {
243 node.type = TTypeNodeType::SCALAR;
244 node.__set_scalar_type(TScalarType());
245 TScalarType& scalar_type = node.scalar_type;
246 scalar_type.__set_type(impala::ToThrift(type, is_binary_));
247 if (type == TYPE_CHAR || type == TYPE_VARCHAR
248 || type == TYPE_FIXED_UDA_INTERMEDIATE) {
249 DCHECK_NE(len, -1);
250 scalar_type.__set_len(len);
251 } else if (type == TYPE_DECIMAL) {
252 DCHECK_NE(precision, -1);
253 DCHECK_NE(scale, -1);
254 scalar_type.__set_precision(precision);
255 scalar_type.__set_scale(scale);
256 }
257 }
258}
259
260string ColumnType::DebugString() const {
261 switch (type) {

Callers 8

GetValueMethod · 0.45
OpenMethod · 0.45
BuildMethod · 0.45
SetRpcParamsMethod · 0.45
CreateRowDescMethod · 0.45
ConstructReportMethod · 0.45
GetStatusReportMethod · 0.45
ToThriftBenchmarkFunction · 0.45

Calls 3

ToThriftFunction · 0.85
push_backMethod · 0.80
sizeMethod · 0.45

Tested by 2

GetValueMethod · 0.36
CreateRowDescMethod · 0.36