Description
The space savings SQL query in getSpaceSavingsSql() can return null values when there are no compressed files in the database, causing the application to crash when JavaScript code expects numeric values.
Problem
When the clp_archives table is empty, the SUM() aggregation functions return NULL instead of 0. This causes crashes when the frontend tries to perform operations on these null values.
Solution
Use COALESCE to provide fallback values of 0 and CAST to ensure proper typing in the SQL query.
Location
File: components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/sql.ts
References
Reported by: junhaoliao
Description
The space savings SQL query in
getSpaceSavingsSql()can return null values when there are no compressed files in the database, causing the application to crash when JavaScript code expects numeric values.Problem
When the
clp_archivestable is empty, theSUM()aggregation functions returnNULLinstead of0. This causes crashes when the frontend tries to perform operations on these null values.Solution
Use
COALESCEto provide fallback values of 0 andCASTto ensure proper typing in the SQL query.Location
File:
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/sql.tsReferences
Reported by: junhaoliao