I have the following table in Clickhouse :
CREATE TABLE mydb.mytable (
`timestampMs` DateTime,
`someId` String,
`someValue` Float64
)
I then use the following code to insert rows in this table :
Connection connection = DriverManager.getConnection("jdbc:clickhouse://" + clickhouseEndpoint, user, passwd);
ClickHouseStatement sth = (ClickHouseStatement) connection.createStatement();
String myRow = "1594806134000,myId1,58.8";
String myfields = "(timestampMs, someId, someValue)";
String myQuery = "INSERT INTO mydb.mytable " + myfields;
sth.write()
.sql(myQuery)
.data(new ByteArrayInputStream(myRow.getBytes()), ClickHouseFormat.CSV)
.send();
The code run without any errors or warnings. But when I check the data stored in clickhouse :
curl -XGET https://my/clickhouse/endpoint/?query=SELECT * FROM mydb.mytable
I get the following output :
2013-07-02 15:49:44 myId1 58.8
Here, the fields someId and someValue have the expected value, but the timestamp field is wrong. The expected value was timestampMs = 2020-07-15 9:42:14
What might be the problem here and what should I do to fix it ?