housepower / ClickHouse-Native-JDBC

ClickHouse Native Protocol JDBC implementation
https://housepower.github.io/ClickHouse-Native-JDBC/
Apache License 2.0
527 stars 145 forks source link

How to insert the Array(Float32) data type #458

Closed jiaxin11 closed 11 months ago

jiaxin11 commented 11 months ago

CREATE TABLE faceDetect.faceCache (
embedding Array(Float32) ) ENGINE = MergeTree

Array embedding = conn.createArrayOf("Float32", new Object[]{-1.4534375667572021});

PreparedStatement preparedStatement = conn.prepareStatement("INSERT INTO faceDetect.faceCache VALUES (?)"); preparedStatement.setArray(1, embedding); preparedStatement.execute();

Insert database value becomes [-1.4534376]

Here's my sql statement, but it doesn't work and the data is missing precision