From 3e39b15aebd3977b3e3376e0e553516b596c08b8 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Mon, 23 Mar 2026 11:43:38 -0400 Subject: [PATCH] Fix FinOps expensive queries error + imported parquet warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. FinOps expensive queries query referenced statement_start_offset and statement_end_offset columns that don't exist in the DuckDB query_stats schema. Removed from GROUP BY — sql_handle + query_text is sufficient for grouping. 2. Archive compaction didn't recognize imported_ prefixed parquet files from the data import feature. Added regex patterns for imported_YYYYMM_tablename and imported_YYYYMMDD_HHMM_tablename. Co-Authored-By: Claude Opus 4.6 (1M context) --- Lite/Services/ArchiveService.cs | 22 ++++++++++++++++++++++ Lite/Services/LocalDataService.FinOps.cs | 2 -- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Lite/Services/ArchiveService.cs b/Lite/Services/ArchiveService.cs index 70c66cb5..76925130 100644 --- a/Lite/Services/ArchiveService.cs +++ b/Lite/Services/ArchiveService.cs @@ -247,6 +247,28 @@ private void CompactParquetFiles() } } + /* imported_YYYYMM_tablename (imported from previous install) */ + if (month == null) + { + m = Regex.Match(name, @"^imported_(\d{6})_(.+)$"); + if (m.Success) + { + month = m.Groups[1].Value; + table = m.Groups[2].Value; + } + } + + /* imported_YYYYMMDD_HHMM_tablename (imported per-cycle files) */ + if (month == null) + { + m = Regex.Match(name, @"^imported_(\d{8})_\d{4}_(.+)$"); + if (m.Success) + { + month = m.Groups[1].Value[..6]; + table = m.Groups[2].Value; + } + } + /* YYYYMM_tablename (already monthly — our target format) */ if (month == null) { diff --git a/Lite/Services/LocalDataService.FinOps.cs b/Lite/Services/LocalDataService.FinOps.cs index 985edaac..2569f580 100644 --- a/Lite/Services/LocalDataService.FinOps.cs +++ b/Lite/Services/LocalDataService.FinOps.cs @@ -1219,8 +1219,6 @@ AND delta_worker_time > 0 GROUP BY database_name, sql_handle, - statement_start_offset, - statement_end_offset, query_text ORDER BY SUM(delta_worker_time) DESC LIMIT $3";