support show db disk info

This commit is contained in:
yihaoDeng 2024-11-02 21:36:08 +08:00
parent 160e2686c4
commit b38d5a2492
6 changed files with 5158 additions and 6223 deletions

View File

@ -206,204 +206,205 @@
#define TK_VIEWS 188
#define TK_VIEW 189
#define TK_COMPACTS 190
#define TK_NORMAL 191
#define TK_CHILD 192
#define TK_LIKE 193
#define TK_TBNAME 194
#define TK_QTAGS 195
#define TK_AS 196
#define TK_SYSTEM 197
#define TK_TSMA 198
#define TK_INTERVAL 199
#define TK_RECURSIVE 200
#define TK_TSMAS 201
#define TK_FUNCTION 202
#define TK_INDEX 203
#define TK_COUNT 204
#define TK_LAST_ROW 205
#define TK_META 206
#define TK_ONLY 207
#define TK_TOPIC 208
#define TK_CONSUMER 209
#define TK_GROUP 210
#define TK_DESC 211
#define TK_DESCRIBE 212
#define TK_RESET 213
#define TK_QUERY 214
#define TK_CACHE 215
#define TK_EXPLAIN 216
#define TK_ANALYZE 217
#define TK_VERBOSE 218
#define TK_NK_BOOL 219
#define TK_RATIO 220
#define TK_NK_FLOAT 221
#define TK_OUTPUTTYPE 222
#define TK_AGGREGATE 223
#define TK_BUFSIZE 224
#define TK_LANGUAGE 225
#define TK_REPLACE 226
#define TK_STREAM 227
#define TK_INTO 228
#define TK_PAUSE 229
#define TK_RESUME 230
#define TK_PRIMARY 231
#define TK_KEY 232
#define TK_TRIGGER 233
#define TK_AT_ONCE 234
#define TK_WINDOW_CLOSE 235
#define TK_IGNORE 236
#define TK_EXPIRED 237
#define TK_FILL_HISTORY 238
#define TK_SUBTABLE 239
#define TK_UNTREATED 240
#define TK_KILL 241
#define TK_CONNECTION 242
#define TK_TRANSACTION 243
#define TK_BALANCE 244
#define TK_VGROUP 245
#define TK_LEADER 246
#define TK_MERGE 247
#define TK_REDISTRIBUTE 248
#define TK_SPLIT 249
#define TK_DELETE 250
#define TK_INSERT 251
#define TK_NK_BIN 252
#define TK_NK_HEX 253
#define TK_NULL 254
#define TK_NK_QUESTION 255
#define TK_NK_ALIAS 256
#define TK_NK_ARROW 257
#define TK_ROWTS 258
#define TK_QSTART 259
#define TK_QEND 260
#define TK_QDURATION 261
#define TK_WSTART 262
#define TK_WEND 263
#define TK_WDURATION 264
#define TK_IROWTS 265
#define TK_ISFILLED 266
#define TK_FLOW 267
#define TK_FHIGH 268
#define TK_FROWTS 269
#define TK_CAST 270
#define TK_POSITION 271
#define TK_IN 272
#define TK_FOR 273
#define TK_NOW 274
#define TK_TODAY 275
#define TK_RAND 276
#define TK_SUBSTR 277
#define TK_SUBSTRING 278
#define TK_BOTH 279
#define TK_TRAILING 280
#define TK_LEADING 281
#define TK_TIMEZONE 282
#define TK_CLIENT_VERSION 283
#define TK_SERVER_VERSION 284
#define TK_SERVER_STATUS 285
#define TK_CURRENT_USER 286
#define TK_PI 287
#define TK_CASE 288
#define TK_WHEN 289
#define TK_THEN 290
#define TK_ELSE 291
#define TK_BETWEEN 292
#define TK_IS 293
#define TK_NK_LT 294
#define TK_NK_GT 295
#define TK_NK_LE 296
#define TK_NK_GE 297
#define TK_NK_NE 298
#define TK_MATCH 299
#define TK_NMATCH 300
#define TK_CONTAINS 301
#define TK_JOIN 302
#define TK_INNER 303
#define TK_LEFT 304
#define TK_RIGHT 305
#define TK_OUTER 306
#define TK_SEMI 307
#define TK_ANTI 308
#define TK_ASOF 309
#define TK_WINDOW 310
#define TK_WINDOW_OFFSET 311
#define TK_JLIMIT 312
#define TK_SELECT 313
#define TK_NK_HINT 314
#define TK_DISTINCT 315
#define TK_WHERE 316
#define TK_PARTITION 317
#define TK_BY 318
#define TK_SESSION 319
#define TK_STATE_WINDOW 320
#define TK_EVENT_WINDOW 321
#define TK_COUNT_WINDOW 322
#define TK_ANOMALY_WINDOW 323
#define TK_SLIDING 324
#define TK_FILL 325
#define TK_VALUE 326
#define TK_VALUE_F 327
#define TK_NONE 328
#define TK_PREV 329
#define TK_NULL_F 330
#define TK_LINEAR 331
#define TK_NEXT 332
#define TK_HAVING 333
#define TK_RANGE 334
#define TK_EVERY 335
#define TK_ORDER 336
#define TK_SLIMIT 337
#define TK_SOFFSET 338
#define TK_LIMIT 339
#define TK_OFFSET 340
#define TK_ASC 341
#define TK_NULLS 342
#define TK_ABORT 343
#define TK_AFTER 344
#define TK_ATTACH 345
#define TK_BEFORE 346
#define TK_BEGIN 347
#define TK_BITAND 348
#define TK_BITNOT 349
#define TK_BITOR 350
#define TK_BLOCKS 351
#define TK_CHANGE 352
#define TK_COMMA 353
#define TK_CONCAT 354
#define TK_CONFLICT 355
#define TK_COPY 356
#define TK_DEFERRED 357
#define TK_DELIMITERS 358
#define TK_DETACH 359
#define TK_DIVIDE 360
#define TK_DOT 361
#define TK_EACH 362
#define TK_FAIL 363
#define TK_GLOB 364
#define TK_ID 365
#define TK_IMMEDIATE 366
#define TK_IMPORT 367
#define TK_INITIALLY 368
#define TK_INSTEAD 369
#define TK_ISNULL 370
#define TK_MODULES 371
#define TK_NK_BITNOT 372
#define TK_NK_SEMI 373
#define TK_NOTNULL 374
#define TK_OF 375
#define TK_PLUS 376
#define TK_PRIVILEGE 377
#define TK_RAISE 378
#define TK_RESTRICT 379
#define TK_ROW 380
#define TK_STAR 381
#define TK_STATEMENT 382
#define TK_STRICT 383
#define TK_STRING 384
#define TK_TIMES 385
#define TK_VALUES 386
#define TK_VARIABLE 387
#define TK_WAL 388
#define TK_DISK_INFO 191
#define TK_NORMAL 192
#define TK_CHILD 193
#define TK_LIKE 194
#define TK_TBNAME 195
#define TK_QTAGS 196
#define TK_AS 197
#define TK_SYSTEM 198
#define TK_TSMA 199
#define TK_INTERVAL 200
#define TK_RECURSIVE 201
#define TK_TSMAS 202
#define TK_FUNCTION 203
#define TK_INDEX 204
#define TK_COUNT 205
#define TK_LAST_ROW 206
#define TK_META 207
#define TK_ONLY 208
#define TK_TOPIC 209
#define TK_CONSUMER 210
#define TK_GROUP 211
#define TK_DESC 212
#define TK_DESCRIBE 213
#define TK_RESET 214
#define TK_QUERY 215
#define TK_CACHE 216
#define TK_EXPLAIN 217
#define TK_ANALYZE 218
#define TK_VERBOSE 219
#define TK_NK_BOOL 220
#define TK_RATIO 221
#define TK_NK_FLOAT 222
#define TK_OUTPUTTYPE 223
#define TK_AGGREGATE 224
#define TK_BUFSIZE 225
#define TK_LANGUAGE 226
#define TK_REPLACE 227
#define TK_STREAM 228
#define TK_INTO 229
#define TK_PAUSE 230
#define TK_RESUME 231
#define TK_PRIMARY 232
#define TK_KEY 233
#define TK_TRIGGER 234
#define TK_AT_ONCE 235
#define TK_WINDOW_CLOSE 236
#define TK_IGNORE 237
#define TK_EXPIRED 238
#define TK_FILL_HISTORY 239
#define TK_SUBTABLE 240
#define TK_UNTREATED 241
#define TK_KILL 242
#define TK_CONNECTION 243
#define TK_TRANSACTION 244
#define TK_BALANCE 245
#define TK_VGROUP 246
#define TK_LEADER 247
#define TK_MERGE 248
#define TK_REDISTRIBUTE 249
#define TK_SPLIT 250
#define TK_DELETE 251
#define TK_INSERT 252
#define TK_NK_BIN 253
#define TK_NK_HEX 254
#define TK_NULL 255
#define TK_NK_QUESTION 256
#define TK_NK_ALIAS 257
#define TK_NK_ARROW 258
#define TK_ROWTS 259
#define TK_QSTART 260
#define TK_QEND 261
#define TK_QDURATION 262
#define TK_WSTART 263
#define TK_WEND 264
#define TK_WDURATION 265
#define TK_IROWTS 266
#define TK_ISFILLED 267
#define TK_FLOW 268
#define TK_FHIGH 269
#define TK_FROWTS 270
#define TK_CAST 271
#define TK_POSITION 272
#define TK_IN 273
#define TK_FOR 274
#define TK_NOW 275
#define TK_TODAY 276
#define TK_RAND 277
#define TK_SUBSTR 278
#define TK_SUBSTRING 279
#define TK_BOTH 280
#define TK_TRAILING 281
#define TK_LEADING 282
#define TK_TIMEZONE 283
#define TK_CLIENT_VERSION 284
#define TK_SERVER_VERSION 285
#define TK_SERVER_STATUS 286
#define TK_CURRENT_USER 287
#define TK_PI 288
#define TK_CASE 289
#define TK_WHEN 290
#define TK_THEN 291
#define TK_ELSE 292
#define TK_BETWEEN 293
#define TK_IS 294
#define TK_NK_LT 295
#define TK_NK_GT 296
#define TK_NK_LE 297
#define TK_NK_GE 298
#define TK_NK_NE 299
#define TK_MATCH 300
#define TK_NMATCH 301
#define TK_CONTAINS 302
#define TK_JOIN 303
#define TK_INNER 304
#define TK_LEFT 305
#define TK_RIGHT 306
#define TK_OUTER 307
#define TK_SEMI 308
#define TK_ANTI 309
#define TK_ASOF 310
#define TK_WINDOW 311
#define TK_WINDOW_OFFSET 312
#define TK_JLIMIT 313
#define TK_SELECT 314
#define TK_NK_HINT 315
#define TK_DISTINCT 316
#define TK_WHERE 317
#define TK_PARTITION 318
#define TK_BY 319
#define TK_SESSION 320
#define TK_STATE_WINDOW 321
#define TK_EVENT_WINDOW 322
#define TK_COUNT_WINDOW 323
#define TK_ANOMALY_WINDOW 324
#define TK_SLIDING 325
#define TK_FILL 326
#define TK_VALUE 327
#define TK_VALUE_F 328
#define TK_NONE 329
#define TK_PREV 330
#define TK_NULL_F 331
#define TK_LINEAR 332
#define TK_NEXT 333
#define TK_HAVING 334
#define TK_RANGE 335
#define TK_EVERY 336
#define TK_ORDER 337
#define TK_SLIMIT 338
#define TK_SOFFSET 339
#define TK_LIMIT 340
#define TK_OFFSET 341
#define TK_ASC 342
#define TK_NULLS 343
#define TK_ABORT 344
#define TK_AFTER 345
#define TK_ATTACH 346
#define TK_BEFORE 347
#define TK_BEGIN 348
#define TK_BITAND 349
#define TK_BITNOT 350
#define TK_BITOR 351
#define TK_BLOCKS 352
#define TK_CHANGE 353
#define TK_COMMA 354
#define TK_CONCAT 355
#define TK_CONFLICT 356
#define TK_COPY 357
#define TK_DEFERRED 358
#define TK_DELIMITERS 359
#define TK_DETACH 360
#define TK_DIVIDE 361
#define TK_DOT 362
#define TK_EACH 363
#define TK_FAIL 364
#define TK_GLOB 365
#define TK_ID 366
#define TK_IMMEDIATE 367
#define TK_IMPORT 368
#define TK_INITIALLY 369
#define TK_INSTEAD 370
#define TK_ISNULL 371
#define TK_MODULES 372
#define TK_NK_BITNOT 373
#define TK_NK_SEMI 374
#define TK_NOTNULL 375
#define TK_OF 376
#define TK_PLUS 377
#define TK_PRIVILEGE 378
#define TK_RAISE 379
#define TK_RESTRICT 380
#define TK_ROW 381
#define TK_STAR 382
#define TK_STATEMENT 383
#define TK_STRICT 384
#define TK_STRING 385
#define TK_TIMES 386
#define TK_VALUES 387
#define TK_VARIABLE 388
#define TK_WAL 389
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601

View File

@ -319,6 +319,7 @@ SNode* createDefaultTSMAOptions(SAstCreateContext* pCxt);
SNode* createDropTSMAStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable);
SNode* createShowCreateTSMAStmt(SAstCreateContext* pCxt, SNode* pRealTable);
SNode* createShowTSMASStmt(SAstCreateContext* pCxt, SNode* dbName);
SNode* createShowDiskUsageStmt(SAstCreateContext* pCxt, SNode* dbName, ENodeType type);
#ifdef __cplusplus
}

View File

@ -577,6 +577,7 @@ cmd ::= SHOW db_name_cond_opt(A) VIEWS like_pattern_opt(B).
cmd ::= SHOW CREATE VIEW full_table_name(A). { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, A); }
cmd ::= SHOW COMPACTS. { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
cmd ::= SHOW COMPACT NK_INTEGER(A). { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
cmd ::= SHOW db_name_cond_opt(A) DISK_INFO. { pCxt->pRootNode = createShowDiskUsageStmt(pCxt, A, QUERY_NODE_SHOW_USAGE_STMT); }
%type table_kind_db_name_cond_opt { SShowTablesOption }
%destructor table_kind_db_name_cond_opt { }

View File

@ -1974,7 +1974,7 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
case DB_OPTION_S3_COMPACT:
pDbOptions->s3Compact = taosStr2Int8(((SToken*)pVal)->z, NULL, 10);
break;
case DB_OPTION_KEEP_TIME_OFFSET:
case DB_OPTION_KEEP_TIME_OFFSET:
pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
break;
case DB_OPTION_ENCRYPT_ALGORITHM:
@ -3876,3 +3876,16 @@ _err:
nodesDestroyNode(dbName);
return NULL;
}
SNode* createShowDiskUsageStmt(SAstCreateContext* pCxt, SNode* dbName, ENodeType type) {
CHECK_PARSER_STATUS(pCxt);
SShowStmt* pStmt = NULL;
pCxt->errCode = nodesMakeNode(type, (SNode**)&pStmt);
CHECK_MAKE_NODE(pStmt);
pStmt->pDbName = dbName;
return (SNode*)pStmt;
_err:
nodesDestroyNode(dbName);
return NULL;
}

View File

@ -347,6 +347,7 @@ static SKeyword keywordTable[] = {
{"KEEP_TIME_OFFSET", TK_KEEP_TIME_OFFSET},
{"ARBGROUPS", TK_ARBGROUPS},
{"IS_IMPORT", TK_IS_IMPORT},
{"DISK_INFO", TK_DISK_INFO},
};
// clang-format on

File diff suppressed because it is too large Load Diff