pmm-motif opened a new issue, #34587:
URL: https://github.com/apache/arrow/issues/34587
### Describe the bug, including details regarding any error messages,
version, and platform.
It looks that when the Timestamp unit is set to Seconds, the setter is
losing precision. E.g. for following table:
```typescript
const table = new Table({
ts: vectorFromArray(
[1677692667],
new Timestamp(TimeUnit.SECOND)
)})
```
The actual value after retrieving by `get` will be `1677692000` rather than
`1677692667`
I believe the reason for doing so is how
[setTimestampSecond](https://github.com/apache/arrow/blob/main/js/src/visitor/set.ts#L173)
and
[getTimestampSecond](https://github.com/apache/arrow/blob/main/js/src/visitor/get.ts#L172)
are constructed.
If the underlying data model would store values in milliseconds, then I
think the operations (`/ 1000` and `* 1000`) should have been opposite in
`getTimestampSecond`/`setTimestampSecond`. However, I think this should be
plain seconds so no actual multiplications/divisions needed? Or maybe there's
some conversion to milliseconds beforehand which I missed? I tried to do a
quick fix but than it was failing in `test/unit/generated-data-validators.ts`
and got a bit lost. I'm also not sure why the other methods (setting/getting
microseconds or nanoseconds) do a multiplication and division as well.
### Component(s)
JavaScript
--
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]