question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select from map with LowCardinality keys returns ClickHouseUnknownException: ClickHouse exception, message: Parse exception: ByteFragment

See original GitHub issue

Hello,

My setup Clickhouse server version 21.9.4 revision 54449 Clickhouse client version 21.9.4.35 JDBC version 0.3.1

Native client works

CREATE TABLE lcmap (m Map(LowCardinality(String), Int32)) ENGINE=Memory;
//...
INSERT INTO lcmap(m) VALUES ({'key1':1});

//...
select * from lcmap;
//...
┌─m──────────┐
│ {'key1':1} │
└────────────

But when I try to execute select * from lcmap; in Datagrip I get

<failed to load>
ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, message: Parse exception: ByteFragment{[{'key1':1}], start=0, len=10}; null
	at ru.yandex.clickhouse.response.ClickHouseResultSet.getObject(ClickHouseResultSet.java:648)
	in JdbcHelperImpl.getObject(JdbcHelperImpl.java:321)
Caused by: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:221)
	at ru.yandex.clickhouse.response.parser.ClickHouseMapParser.parse(ClickHouseMapParser.java:119)
	at ru.yandex.clickhouse.response.parser.ClickHouseMapParser.parse(ClickHouseMapParser.java:17)
	at ru.yandex.clickhouse.response.ClickHouseResultSet.getObject(ClickHouseResultSet.java:749)
	at ru.yandex.clickhouse.response.ClickHouseResultSet.getObject(ClickHouseResultSet.java:642)
	... 21 more

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
zhicwucommented, Oct 5, 2021

Sorry I’m in the middle of merging new gRPC client into develop branch. After which, I’ll create another pull request by updating JDBC driver, clickhouse-jdbc module to be more specific, to use the new client in order to support more data types.

If you’re familiar with Java, you may play with the new client in these two days to explore what’s coming next.

1reaction
zhicwucommented, Oct 5, 2021

Thanks for reporting the issue. The driver does not support nested data types very well at this point. It understands Map(String, Int32) but not Map(LowCardinality(String), Int32), Map(String, Nullable(Int32)), or Map<String, Tuple(Int32, Array())>. Actually these cases work in an in-development version, so I believe this will be addressed in next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LowCardinality Data Type | ClickHouse Docs
LowCardinality is a superstructure that changes a data storage method and rules of data ... increases performance of SELECT queries for many applications....
Read more >
Using Array(Tuple(LowCardinality(String), Int32)) in ClickHouse
Until it will be fixed (see bug 7815), can be used this workaround: SELECT uniqExact((id, date)) AS count FROM table ARRAY JOIN values...
Read more >
clickhouse-jdbc - bytemeta
Select from map with LowCardinality keys returns ClickHouseUnknownException: ClickHouse exception, message: Parse exception: ByteFragment. PavelRuban.
Read more >
ClickHouse tips #10: Null behavior with LowCardinality columns
If you have LowCardinality(String) column, inserting a NULL value will work fine. ... DB::Exception: Sorting key cannot contain nullable columns.
Read more >
Polling_Interval attribute not initialized in Azure Datafactory ...
Select from map with LowCardinality keys returns ClickHouseUnknownException: ClickHouse exception, message: Parse exception: ByteFragment, 5, 2021-10-04, 2022- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found