From 7925ba7f5fe7b687893f4e0db35f60c6696f6ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Erades?= Date: Thu, 18 Apr 2024 10:54:33 +0200 Subject: [PATCH] Dashboards: Fix query in Data Analysis dashboard Similar to the issue fixed by #487, there is a missmatch in the "Database summary" panel, as it uses data_uncompressed_bytes in the outer query (this seems to be the wanted columns, as it is defined in the "Organize fields by name" transformation) but uses data_compressed_bytes in the inner query, causing an error. This PR sets the right column in the inner query and fixes #803 --- src/dashboards/data-analysis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dashboards/data-analysis.json b/src/dashboards/data-analysis.json index 335ed6da..530a56b3 100644 --- a/src/dashboards/data-analysis.json +++ b/src/dashboards/data-analysis.json @@ -1093,7 +1093,7 @@ } }, "queryType": "sql", - "rawSql": "SELECT name,\n engine,\n tables,\n partitions,\n parts,\n formatReadableSize(bytes_on_disk) \"disk_size\",\n col_count,\n total_rows,\n formatReadableSize(data_uncompressed_bytes) as \"uncompressed_size\"\nFROM system.databases db\n LEFT JOIN ( SELECT database,\n uniq(table) \"tables\",\n uniq(table, partition) \"partitions\",\n count() AS parts,\n sum(bytes_on_disk) \"bytes_on_disk\",\n sum(data_compressed_bytes) as \"data_compressed_bytes\",\n sum(rows) as total_rows,\n max(col_count) as \"col_count\"\n FROM system.parts AS parts\n JOIN (SELECT database, count() as col_count\n FROM system.columns\n WHERE database IN (${database}) AND table IN (${table})\n GROUP BY database) as col_stats\n ON parts.database = col_stats.database\n WHERE database IN (${database}) AND active AND table IN (${table})\n GROUP BY database) AS db_stats ON db.name = db_stats.database\nWHERE database IN (${database}) AND lower(name) != 'information_schema'\nORDER BY bytes_on_disk DESC\nLIMIT 10;", + "rawSql": "SELECT name,\n engine,\n tables,\n partitions,\n parts,\n formatReadableSize(bytes_on_disk) \"disk_size\",\n col_count,\n total_rows,\n formatReadableSize(data_uncompressed_bytes) as \"uncompressed_size\"\nFROM system.databases db\n LEFT JOIN ( SELECT database,\n uniq(table) \"tables\",\n uniq(table, partition) \"partitions\",\n count() AS parts,\n sum(bytes_on_disk) \"bytes_on_disk\",\n sum(data_uncompressed_bytes) as \"data_uncompressed_bytes\",\n sum(rows) as total_rows,\n max(col_count) as \"col_count\"\n FROM system.parts AS parts\n JOIN (SELECT database, count() as col_count\n FROM system.columns\n WHERE database IN (${database}) AND table IN (${table})\n GROUP BY database) as col_stats\n ON parts.database = col_stats.database\n WHERE database IN (${database}) AND active AND table IN (${table})\n GROUP BY database) AS db_stats ON db.name = db_stats.database\nWHERE database IN (${database}) AND lower(name) != 'information_schema'\nORDER BY bytes_on_disk DESC\nLIMIT 10;", "refId": "A" } ],