MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / GetCdColumns

Method GetCdColumns

src/codec/schema_codec.h:190–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188 }
189
190 static fedb::base::ResultMsg GetCdColumns(const Schema& schema,
191 const std::map<std::string, std::string>& cd_columns_map,
192 ::google::protobuf::RepeatedPtrField<::fedb::api::Columns>*
193 cd_columns) {
194 fedb::base::ResultMsg rm;
195 std::map<std::string, ::fedb::type::DataType> name_type_map;
196 for (const auto& col_desc : schema) {
197 name_type_map.insert(std::make_pair(
198 col_desc.name(), col_desc.data_type()));
199 }
200 for (const auto& kv : cd_columns_map) {
201 auto iter = name_type_map.find(kv.first);
202 if (iter == name_type_map.end()) {
203 rm.code = -1;
204 rm.msg = "query failed! col_name " + kv.first + " not exist";
205 return rm;
206 }
207 ::fedb::api::Columns* index = cd_columns->Add();
208 index->add_name(kv.first);
209 if (kv.second == NONETOKEN || kv.second == "null") {
210 continue;
211 }
212 }
213 rm.code = 0;
214 rm.msg = "ok";
215 return rm;
216 }
217
218 private:
219 // calc the total size of schema

Callers

nothing calls this directly

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected