CritasWang opened a new issue, #14:
URL: https://github.com/apache/iotdb-client-nodejs/issues/14
### Description
The Node.js client serializes `DATE` (TSDataType 9) values as **days since
Unix epoch** and deserializes them the same way. IoTDB's actual DATE wire
format is an **INT32 encoded as `year*10000 + month*100 + day`** (e.g.
`2026-07-13` → `20260713`).
Reference implementations that use yyyyMMdd:
- Java: `DateUtils.parseDateExpressionToInt` / `parseIntToDate` (iotdb-core)
- C# client: same yyyyMMdd INT32 encoding
- Rust client (in development): verified via a live adjudication test
against IoTDB 2.0.6 — a row inserted via SQL literal `'2026-07-13'` reads back
as raw i32 `20260713` on the wire
### Impact
- Dates written via `insertTablet` from Node.js are stored as small integers
(~20655 for a 2026 date), which other clients decode as year-0002 nonsense.
- Dates written by any other client (~2026xxxx) decode in Node.js as dates
around year 57000.
### Affected code
- `src/client/Session.ts` `serializeColumn` case 9 (write) and
`deserializeColumn` case 9 (TSQueryDataSet read)
- `src/utils/FastSerializer.ts` `serializeDateColumn`
- `src/client/ColumnDecoder.ts` (TsBlock read; additionally, TsBlock headers
report DATE columns as wire-type INT32(1) — the DATE type only appears in the
response `dataTypeList`, so the decoder needs a metadata-driven conversion)
### Reproduction
Insert `new Date('2026-07-13')` into a DATE timeseries via `insertTablet`,
then `SELECT` it from iotdb-cli or any other client — the stored value is
`20655` instead of `20260713`.
A fix PR follows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]