Skip to content
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

parse named tuples #197

Merged
merged 4 commits into from
Sep 6, 2024
Merged

parse named tuples #197

merged 4 commits into from
Sep 6, 2024

Conversation

ruslandoga
Copy link
Contributor

fixes #196

@@ -523,6 +523,7 @@ defmodule Ch.ConnectionTest do
}} = Ch.query(conn, "SELECT * FROM t_uuid ORDER BY y")
end

@tag :skip
Copy link
Contributor Author

@ruslandoga ruslandoga Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest ClickHouse now has "new JSON" https://clickhouse.com/docs/en/sql-reference/data-types/newjson, I'll add support for it later.

For now the test for "old JSON" is skipped to prevent CI errors.

lib/ch/types.ex Outdated

defp decode_identifier(<<a, rest::bytes>>, len, original, stack, acc) when is_alpha(a) do
defp decode_identifier(<<a, rest::bytes>>, len, original, stack, acc)
when is_alpha(a) or is_numeric(a) do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming identifiers are alphanumeric for now. But it seems like ClickHouse allows more than that. These work:

select tuple(1 as a$, 2 as b);
select tuple(1 as a_, 2 as b);

I'll try to find out what is allowed in identifiers and update it later.

@ruslandoga
Copy link
Contributor Author

ruslandoga commented Sep 6, 2024

Hm, the tests pass locally. My latest ClickHouse is probably outdated now. Pulling a fresh one.


Right, ClickHouse now quotes the identifiers :) This is what we get:

"Tuple(`a$` String, b UInt8)"

I'm dropping decoding $ for now.

@ruslandoga ruslandoga merged commit 424c65a into master Sep 6, 2024
12 checks passed
@ruslandoga ruslandoga deleted the parse-named-tuples branch September 6, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SELECT ('Hello' AS a, 123 AS b) fails on newer Clickhouse versions
1 participant