16
16
17
17
#include " agent/master_info.h"
18
18
#include " exec/schema_scanner/schema_helper.h"
19
+ #include " gen_cpp/Types_types.h" // for TStorageMedium::type
19
20
#include " gutil/strings/substitute.h"
20
21
#include " runtime/string_value.h"
21
22
#include " storage/storage_engine.h"
22
23
#include " storage/tablet.h"
23
24
#include " storage/tablet_manager.h"
24
- #include " types/logical_type.h"
25
25
26
26
namespace starrocks {
27
27
@@ -34,7 +34,7 @@ SchemaScanner::ColumnDesc SchemaBeTabletsScanner::_s_columns[] = {
34
34
{" INDEX_MEM" , TYPE_BIGINT, sizeof (int64_t ), false }, {" CREATE_TIME" , TYPE_BIGINT, sizeof (int64_t ), false },
35
35
{" STATE" , TYPE_VARCHAR, sizeof (StringValue), false }, {" TYPE" , TYPE_VARCHAR, sizeof (StringValue), false },
36
36
{" DATA_DIR" , TYPE_VARCHAR, sizeof (StringValue), false }, {" SHARD_ID" , TYPE_BIGINT, sizeof (int64_t ), false },
37
- {" SCHEMA_HASH" , TYPE_BIGINT, sizeof (int64_t ), false },
37
+ {" SCHEMA_HASH" , TYPE_BIGINT, sizeof (int64_t ), false }, { " MEDIUM_TYPE " , TYPE_VARCHAR, sizeof (StringValue), false },
38
38
};
39
39
40
40
SchemaBeTabletsScanner::SchemaBeTabletsScanner ()
@@ -86,13 +86,24 @@ static const char* keys_type_to_string(KeysType type) {
86
86
}
87
87
}
88
88
89
+ static const char * medium_type_to_string (TStorageMedium::type type) {
90
+ switch (type) {
91
+ case TStorageMedium::SSD:
92
+ return " SSD" ;
93
+ case TStorageMedium::HDD:
94
+ return " HDD" ;
95
+ default :
96
+ return " UNKNOWN" ;
97
+ }
98
+ }
99
+
89
100
Status SchemaBeTabletsScanner::fill_chunk (ChunkPtr* chunk) {
90
101
const auto & slot_id_to_index_map = (*chunk)->get_slot_id_to_index_map ();
91
102
auto end = _cur_idx + 1 ;
92
103
for (; _cur_idx < end; _cur_idx++) {
93
104
auto & info = _infos[_cur_idx];
94
105
for (const auto & [slot_id, index] : slot_id_to_index_map) {
95
- if (slot_id < 1 || slot_id > 17 ) {
106
+ if (slot_id < 1 || slot_id > 18 ) {
96
107
return Status::InternalError (strings::Substitute (" invalid slot id:$0" , slot_id));
97
108
}
98
109
ColumnPtr column = (*chunk)->get_column_by_slot_id (slot_id);
@@ -138,7 +149,7 @@ Status SchemaBeTabletsScanner::fill_chunk(ChunkPtr* chunk) {
138
149
break ;
139
150
}
140
151
case 9 : {
141
- // num rowt
152
+ // num rows
142
153
fill_column_with_slot<TYPE_BIGINT>(column.get (), (void *)&info.num_row );
143
154
break ;
144
155
}
@@ -170,8 +181,8 @@ Status SchemaBeTabletsScanner::fill_chunk(ChunkPtr* chunk) {
170
181
break ;
171
182
}
172
183
case 15 : {
173
- Slice type = Slice (info.data_dir );
174
- fill_column_with_slot<TYPE_VARCHAR>(column.get (), (void *)&type );
184
+ Slice data_dir = Slice (info.data_dir );
185
+ fill_column_with_slot<TYPE_VARCHAR>(column.get (), (void *)&data_dir );
175
186
break ;
176
187
}
177
188
case 16 : {
@@ -182,6 +193,12 @@ Status SchemaBeTabletsScanner::fill_chunk(ChunkPtr* chunk) {
182
193
fill_column_with_slot<TYPE_BIGINT>(column.get (), (void *)&info.schema_hash );
183
194
break ;
184
195
}
196
+ case 18 : {
197
+ // medium type
198
+ Slice medium_type = Slice (medium_type_to_string (info.medium_type ));
199
+ fill_column_with_slot<TYPE_VARCHAR>(column.get (), (void *)&medium_type);
200
+ break ;
201
+ }
185
202
default :
186
203
break ;
187
204
}
0 commit comments