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

Method ExtractArray

be/src/kudu/util/yamlreader.h:102–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101template <typename T>
102Status YamlReader::ExtractArray(const YAML::Node* node,
103 const std::string& field,
104 std::vector<T>* result) {
105 CHECK(result);
106 YAML::Node val;
107 RETURN_NOT_OK(ExtractField(node, field, &val));
108 if (PREDICT_FALSE(!val.IsSequence())) {
109 return Status::Corruption(strings::Substitute(
110 "wrong type during field extraction: expected sequence but got $0",
111 TypeToString(val.Type())));
112 }
113 result->reserve(val.size());
114 for (YAML::const_iterator iter = val.begin(); iter != val.end(); ++iter) {
115 try {
116 if (PREDICT_FALSE(!iter->IsScalar())) {
117 return Status::Corruption(strings::Substitute(
118 "wrong type during field extraction: expected scalar but got $0",
119 TypeToString(iter->Type())));
120 }
121 result->push_back(iter->as<T>());
122 } catch (std::exception& e) {
123 return Status::Corruption(strings::Substitute("parse list element error: $0", e.what()));
124 }
125 }
126 return Status::OK();
127}
128
129} // namespace kudu

Callers

nothing calls this directly

Calls 10

CorruptionFunction · 0.85
SubstituteFunction · 0.85
OKFunction · 0.85
TypeMethod · 0.80
reserveMethod · 0.80
push_backMethod · 0.80
TypeToStringFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected