trino: Clickhouse - java.io.IOException: Reached end of input stream after reading ... of ... bytes

I am getting the following error using the Trino Clickhouse connector

java.io.IOException: Reached end of input stream after reading … of … bytes

I have a Clickhouse table like

column_name data_type
date date
advertisable_eid varbinary
domain varbinary

If I query over multiple dates the query fails with the above error. Example query

select 
date,
from_utf8(domain)
from <table>
where 
  from_utf8(advertisable_eid) = 'x'
  and from_utf8(domain) = 'y'
  and date(date) in (date'2023-06-01', date'2023-06-02') limit 10;

If I restrict this query to one date, it succeeds. A similar query succeeds if we directly query Clickhouse.

Thanks in advance for any help!

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Sorry I cannot help due to very limited knowledge of Trino.

Before the connector is enhanced, an ugly workaround I can think of is to use union query. So SELECT * FROM ch.default.pdtest WHERE date(date) IN (date'2023-04-06', date'2023-04-09') becomes SELECT * FROM ch.default.pdtest WHERE date(date) = date'2023-04-06' union all SELECT * FROM ch.default.pdtest WHERE date(date) = date'2023-04-09' 🤢

You can try the latest Trino version. It uses ClickHouse 0.4.6 JDBC driver internally.