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

Method CalStrLength

src/codec/row_codec.h:40–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38class RowCodec {
39 public:
40 static int32_t CalStrLength(
41 const std::map<std::string, std::string>& str_map,
42 const Schema& schema) {
43 int32_t str_len = 0;
44 for (int i = 0; i < schema.size(); i++) {
45 const ::fedb::common::ColumnDesc& col = schema.Get(i);
46 if (col.data_type() == ::fedb::type::kVarchar ||
47 col.data_type() == ::fedb::type::kString) {
48 auto iter = str_map.find(col.name());
49 if (iter == str_map.end()) {
50 return -1;
51 }
52 if (!col.not_null() &&
53 (iter->second == "null" || iter->second == NONETOKEN)) {
54 continue;
55 } else if (iter->second == "null" ||
56 iter->second == NONETOKEN) {
57 return -1;
58 }
59 str_len += iter->second.length();
60 }
61 }
62 return str_len;
63 }
64
65 static int32_t CalStrLength(const std::vector<std::string>& input_value,
66 const Schema& schema) {

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected