Merge pull request #30021 from taosdata/fix/TS-6076

fix(query): opt show disk_info output
This commit is contained in:
Simon Guan 2025-03-06 17:20:48 +08:00 committed by GitHub
commit 48ad03b696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -797,7 +797,7 @@ static bool funcNotSupportStringSma(SFunctionNode* pFunc) {
} }
EFuncDataRequired statisDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow) { EFuncDataRequired statisDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow) {
if(funcNotSupportStringSma(pFunc)) { if (funcNotSupportStringSma(pFunc)) {
return FUNC_DATA_REQUIRED_DATA_LOAD; return FUNC_DATA_REQUIRED_DATA_LOAD;
} }
return FUNC_DATA_REQUIRED_SMA_LOAD; return FUNC_DATA_REQUIRED_SMA_LOAD;
@ -6618,7 +6618,7 @@ int32_t blockDBUsageFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
double compressRadio = 0; double compressRadio = 0;
if (rawDataSize != 0) { if (rawDataSize != 0) {
compressRadio = totalDiskSize * 100 / (double)rawDataSize; compressRadio = totalDiskSize * 100 / (double)rawDataSize;
len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio=[%.2f]", compressRadio); len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio=[%.2f%]", compressRadio);
} else { } else {
len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio=[NULL]"); len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio=[NULL]");
} }

View File

@ -102,7 +102,8 @@ class TDTestCase:
elif "Compress_radio=" in item[0]: elif "Compress_radio=" in item[0]:
value = item[0].split("=")[1].split(" ")[0].replace("[", "").replace("]", "") value = item[0].split("=")[1].split(" ")[0].replace("[", "").replace("]", "")
if value != 'NULL': if value != 'NULL':
compress_radio = float(value) tValue = value[0:len(value) - 1]
compress_radio = float(tValue)
#tdLog.debug("compress_occupied: %s" % compress_radio) #tdLog.debug("compress_occupied: %s" % compress_radio)
return disk_occupied, compress_radio return disk_occupied, compress_radio