getBlob implementation
Use case
Download binary files from CH
Describe the solution you'd like
Implement
-
Class - ResultSetImpl Method - getBinaryStream(String columnLabel)
-
Class - ResultSetImpl Method - getBlob(String columnLabel)
Describe the alternatives you've considered
QuerySettings querySettings = new QuerySettings(); querySettings.setFormat(ClickHouseFormat.RawBLOB); QueryResponse queryResponse = connection.unwrap(ConnectionImpl.class) .getClient() .query("select ...", querySettings) .get();
Additional context
Good day, @AndrewRazumovskiy ! Thank you for your suggestion!
Would you please describe your use-case?
Thanks!
I store raw binary files in CH (png, pdf, txt, excel), and I want to download them as is, in binary mode
@AndrewRazumovskiy
Thank you for the response!
Do you need Blob for some framework?
However method com.clickhouse.jdbc.ResultSetImpl#getBytes(int) or com.clickhouse.jdbc.ResultSetImpl#getBinaryStream(int) is more straightforward option because has less wrapping classes. I assume there is a column of String type that you want to retrieve.
ResultSetImpl#getBytes throws "Column is not of array type" ResultSetImpl#getBinaryStream returns "BinaryStream is not yet supported" (v0.9.1)
I tried to use jooq, but in the end fall back to native java
ResultSetImpl#getBytes throws "Column is not of array type" ResultSetImpl#getBinaryStream returns "BinaryStream is not yet supported" (v0.9.1) This will be fixed in 0.9.3 (should be ready by end of this month). Here is the issue for that https://github.com/ClickHouse/clickhouse-java/issues/2263
I tried to use jooq, but in the end fall back to native java Jooq as I know is built on top of JDBC and it just adds extra layer of abstractions. We always recommend using clickhouse-java until JDBC is the requirement.