diff --git a/runtime/drivers/olap.go b/runtime/drivers/olap.go index 8221e463220..338e73b43e6 100644 --- a/runtime/drivers/olap.go +++ b/runtime/drivers/olap.go @@ -453,7 +453,7 @@ func (d Dialect) DateDiff(grain runtimev1.TimeGrain, t1, t2 time.Time) (string, unit := d.ConvertToDateTruncSpecifier(grain) switch d { case DialectClickHouse: - return fmt.Sprintf("DATEDIFF('%s', TIMESTAMP '%s', TIMESTAMP '%s')", unit, t1.Format(time.RFC3339), t2.Format(time.RFC3339)), nil + return fmt.Sprintf("DATEDIFF('%s', parseDateTimeBestEffort('%s'), parseDateTimeBestEffort('%s'))", unit, t1.Format(time.RFC3339), t2.Format(time.RFC3339)), nil case DialectDruid: return fmt.Sprintf("TIMESTAMPDIFF(%q, TIME_PARSE('%s'), TIME_PARSE('%s'))", unit, t1.Format(time.RFC3339), t2.Format(time.RFC3339)), nil case DialectDuckDB: