Skip to content

Commit

Permalink
Fix ClickHouse timestamp format for comparison offsets (#6004)
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller authored Oct 31, 2024
1 parent 15a38b8 commit d6f8735
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/drivers/olap.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,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:
Expand Down

0 comments on commit d6f8735

Please sign in to comment.