Conversation
…date_time_mode for clickhouse
8 tasks
Member
Author
|
Tests failing because test CH is old version not supporting this config added in 25.6. |
begelundmuller
requested changes
Jan 9, 2026
runtime/metricsview/astexpr.go
Outdated
| return err | ||
| } | ||
| b.writeString(" AS ") | ||
| b.writeString(cond.Expressions[1].Value.(string)) |
Contributor
There was a problem hiding this comment.
- Unsafe type cast – can we make it safe? (Just to protect against panics)
- Since SQL types differ between different OLAPs, can we use a generic type here that is not DB-specific? Maybe accept a
runtimev1.Type_Codeand usedrivers.Dialectto map it to a SQL type for common types (can just handle timestamps for now)?
Member
Author
There was a problem hiding this comment.
Using runtimev1.Type and also added a test.
Also not setting cast_string_to_date_time_mode in the code by default because we have check for min supported version of 22.7 and this config is available in 25.6. We can set it through connector.clickhouse.query_settings="cast_string_to_date_time_mode='best_effort'" for projects needing this.
begelundmuller
approved these changes
Jan 9, 2026
pjain1
added a commit
that referenced
this pull request
Jan 9, 2026
…t_string_to_date_time_mode" for clickhouse (#8612) * add cast operator support in metrics sql, also enable cast_string_to_date_time_mode for clickhouse * upgrade ch image * test, review comments * lint * better handling * comment * fix web code quality CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CH does not support automatically converting zulu formatted time
2025-12-25T00:00:00Zto DateTime. A configcast_string_to_date_time_modeenables this but still needs a cast to be added to the string typed time value.This fix adds support for CAST operator in
metrics_sqlbut only for DateTime and Timestamp type. This will enables api users to pass in datetime as string with the condition that they cast the param in api likeday >= CAST('{{ .args.startDate }}' AS DateTime). This also supports Rill time functions so this is also supportedday > CAST(time_range_start('P30D') AS DateTime).Checklist: