From 77df6dc63883daa188aec90ae8fad30513d2fdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Tue, 11 Nov 2025 10:22:16 +0100 Subject: [PATCH] revert query builder --- packages/db/src/clickhouse/query-builder.ts | 56 --------------------- 1 file changed, 56 deletions(-) diff --git a/packages/db/src/clickhouse/query-builder.ts b/packages/db/src/clickhouse/query-builder.ts index 08bdb007..351ef6b1 100644 --- a/packages/db/src/clickhouse/query-builder.ts +++ b/packages/db/src/clickhouse/query-builder.ts @@ -261,62 +261,6 @@ export class Query { return this; } - /** - * Safe version of fill that only applies WITH FILL if the date range is valid - * Prevents ClickHouse errors when TO value is less than FROM value - */ - safeFill( - from: string | Date | Expression, - to: string | Date | Expression, - step: string | Expression, - ): this { - // Check if the date range is valid - const isValid = this.isValidDateRange(from, to); - if (isValid) { - return this.fill(from, to, step); - } - // Skip fill if date range is invalid - return this; - } - - private isValidDateRange( - from: string | Date | Expression, - to: string | Date | Expression, - ): boolean { - try { - // If either is an Expression, assume it's valid (can't easily parse) - if (from instanceof Expression || to instanceof Expression) { - return true; - } - - let fromDate: Date; - let toDate: Date; - - if (from instanceof Date) { - fromDate = from; - } else if (typeof from === 'string') { - // Try parsing various date formats - fromDate = new Date(from); - } else { - return true; // Can't determine, assume valid - } - - if (to instanceof Date) { - toDate = to; - } else if (typeof to === 'string') { - toDate = new Date(to); - } else { - return true; // Can't determine, assume valid - } - - // Check if dates are valid and to is after from - return !isNaN(fromDate.getTime()) && !isNaN(toDate.getTime()) && toDate > fromDate; - } catch { - // If any error, assume valid to avoid breaking existing functionality - return true; - } - } - private escapeDate(value: string | Date): string { if (value instanceof Date) { return sqlstring.escape(clix.datetime(value));