| 117 | } |
| 118 | |
| 119 | __attribute__((unused)) static void PrintColumnKey( |
| 120 | const google::protobuf::RepeatedPtrField<::fedb::common::ColumnKey>& column_key_field) { |
| 121 | std::vector<std::string> row; |
| 122 | row.push_back("#"); |
| 123 | row.push_back("index_name"); |
| 124 | row.push_back("col_name"); |
| 125 | row.push_back("ts_col"); |
| 126 | row.push_back("ttl"); |
| 127 | ::baidu::common::TPrinter tp(row.size(), FLAGS_max_col_display_length); |
| 128 | tp.AddRow(row); |
| 129 | uint32_t idx = 0; |
| 130 | for (const auto& column_key : column_key_field) { |
| 131 | if (column_key.flag() == 1) { |
| 132 | continue; |
| 133 | } |
| 134 | row.clear(); |
| 135 | row.push_back(std::to_string(idx)); |
| 136 | row.push_back(column_key.index_name()); |
| 137 | std::string key; |
| 138 | for (const auto& name : column_key.col_name()) { |
| 139 | if (key.empty()) { |
| 140 | key = name; |
| 141 | } else { |
| 142 | key += "|" + name; |
| 143 | } |
| 144 | } |
| 145 | if (key.empty()) { |
| 146 | key = column_key.index_name(); |
| 147 | } |
| 148 | row.push_back(key); |
| 149 | if (!column_key.ts_name().empty()) { |
| 150 | row.push_back(column_key.ts_name()); |
| 151 | } else { |
| 152 | row.push_back("-"); |
| 153 | } |
| 154 | if (column_key.has_ttl()) { |
| 155 | ::fedb::storage::TTLSt cur_ttl_st(column_key.ttl()); |
| 156 | cur_ttl_st.abs_ttl = cur_ttl_st.abs_ttl / (60 * 1000); |
| 157 | row.push_back(cur_ttl_st.ToString()); |
| 158 | } else { |
| 159 | row.push_back("-"); |
| 160 | } |
| 161 | tp.AddRow(row); |
| 162 | idx++; |
| 163 | } |
| 164 | tp.Print(true); |
| 165 | } |
| 166 | |
| 167 | __attribute__((unused)) static void ShowTableRows( |
| 168 | bool is_compress, ::fedb::codec::SDKCodec* codec, |