-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query parameters support #854
Merged
Merged
Conversation
This file contains 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
genzgd
reviewed
Dec 20, 2022
et
added a commit
to highlight/highlight
that referenced
this pull request
Jul 27, 2023
## Summary <!-- Ideally, there is an attached GitHub issue that will describe the "why". If relevant, use this section to call out any additional information you'd like to _highlight_ to the reviewer. --> Clickhouse tests are currently failing on main ([slack](https://highlightcorp.slack.com/archives/C02CJANPHQS/p1690479345204819)): ``` cursor_test.go:196: Error Trace: /home/runner/work/highlight/highlight/backend/clickhouse/cursor_test.go:196 Error: Received unexpected error: clickhouse [Decode]: custom serialization for column Body. not supported Test: TestClickhouseDecode --- FAIL: TestClickhouseDecode (0.04s) panic: runtime error: index out of range [0] with length 0 [recovered] panic: runtime error: index out of range [0] with length 0 ```` I can't tell what is exactly going, but something with the [latest tag](https://hub.docker.com/layers/clickhouse/clickhouse-server/23.7.1/images/sha256-4ee2d642df3481db1809ca632bd3f9d67b1245a75813fb2d618293d7aabed414?context=explore) in docker hits this codepath: https://github.com/ClickHouse/clickhouse-go/blame/main/lib/proto/block.go#L222-L230 Per the [PR](ClickHouse/clickhouse-go#854) that implemented this, perhaps we need to to be explicit on the column types when we query? I've filed #6141 to figure that out. This PR hardcodes the clickhouse version we fetch in docker. The version is pulled from the closet tag that matches clickhouse cloud (`SELECT version()` => `23.5.1.34446`). ## How did you test this change? <!-- Frontend - Leave a screencast or a screenshot to visually describe the changes. --> Reset go test cache: `go clean -testcache` Rerun any clickhouse test and confirm it passes. CI should also pass as well. ## Are there any deployment considerations? <!-- Backend - Do we need to consider migrations or backfilling data? -->
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.
Add a basic query parameters support as implemented in ClickHouse/ClickHouse#39906
This implementation is basic and does not support type conversion. The user is forced to pass parameter values as a string compatible with CH syntax literals.
The native protocol implementation is not documented (yet). For an idea of how it works you can check:
https://clickhouse.com/docs/en/interfaces/http/#cli-queries-with-parameters
https://clickhouse.com/docs/en/interfaces/cli/#cli-queries-with-parameters
ClickHouse supports the following parameter syntax:
Example SQL:
SELECT {str:String}, {arr:Array(String)}
There are two ways to provide parameters. With query context:
or as compatible with named param:
resolves #625