fix(clickhouse-driver): override generic string type in sqlTemplates - #11544
Open
AngelaMCarlos wants to merge 1 commit into
Open
fix(clickhouse-driver): override generic string type in sqlTemplates#11544AngelaMCarlos wants to merge 1 commit into
AngelaMCarlos wants to merge 1 commit into
Conversation
ClickHouse type names are case-sensitive: CAST(x, 'STRING') fails with "Unknown data type family: STRING". sqlTemplates() overrides boolean and timestamp but not string, so any generated SQL casting to the generic string type fails - LAG/LEAD SQL API pushdown, and count measures over composite primary keys with the Tesseract planner. Fixes cube-js#10415
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.
Description
Fixes #10415.
ClickHouse type names are case-sensitive:
CAST(x, 'STRING')fails withUnknown data type family: STRING. Maybe you meant: ['String','Ring'].ClickHouseQuery.sqlTemplates()overridesbooleanandtimestampbut notstring, so any generated SQL that casts to the generic string type fails against ClickHouse:CAST(NULL, 'STRING') AS __user,CAST(NULL, 'STRING') AS __cubejoinfield(ClickHouse: CAST(NULL, 'STRING') fails — ClickHouseQuery missing string type override #10415).countmeasures over composite primary keys with the Tesseract planner (v1.7): the key concatenation is emitted ascount(concat(CAST(pk1, 'STRING'), CAST(pk2, 'STRING'), ...)), so any such measure returns HTTP 400. Reproduced on v1.7.19 with a plain REST query on a cube whose dimensions declare twoprimary_key: truecolumns and atype: countmeasure withoutsql.This one-line change adds
templates.types.string = 'String';next to the existing overrides, aligning the ClickHouse dialect with its case-sensitive type names.Check List
sqlTemplatesassertion toclickhouse-query.test.tsif maintainers want one