You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TIMESTAMP values are encoded as double instead of int64 #2
Only relevant once we move to IoTDB ≥ 1.3.3: 1.3.2 doesn't support the TIMESTAMP type at all. The upgrade also needs the generated Thrift client to be regenerated.
Problem
For TIMESTAMP values, valuesToBuffer writes writeDoubleBE(date.getTime()). IoTDB reads TIMESTAMP as an int64 (ms since epoch). Both are 8 bytes, so the server accepts the insert without error and stores the wrong value.
Example on apache/iotdb:1.3.3-standalone: a value of 1700000000000 (2023-11-14) is stored as 4789786004267466752 (year +151784246). Reading it back with QueryResult returns Invalid Date.
The unit test "should handle Date object with TIMESTAMP by default" reads the value back with readDoubleBE, so it passes despite the bug.
Fix
In valuesToBuffer, write date.writeBigInt64BE(BigInt(value.getTime()), 1).
Change that test to expect int64Buffer(date.getTime()).
Notes
Values written with the bug can be recovered: read the stored int64's bits back as a double.
On 1.3.2, type codes 8–11 (TIMESTAMP, DATE, BLOB, STRING) are rejected with Index 8 out of bounds for length 8. When no type is passed, valuesToBuffer turns a string into STRING, a Date into TIMESTAMP and a Buffer into BLOB. Until we upgrade, callers must pass explicit types for those values.
Activity