You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "pmm-motif (via GitHub)" <gi...@apache.org> on 2023/03/16 13:59:20 UTC

[GitHub] [arrow] pmm-motif opened a new issue, #34587: [JS] Setting timestamp as seconds rounds it down to previous 1000s

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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] pmm-motif closed issue #34587: [JS] Setting timestamp as seconds rounds it down to previous 1000s

Posted by "pmm-motif (via GitHub)" <gi...@apache.org>.
pmm-motif closed issue #34587: [JS] Setting timestamp as seconds rounds it down to previous 1000s
URL: https://github.com/apache/arrow/issues/34587


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] pmm-motif commented on issue #34587: [JS] Setting timestamp as seconds rounds it down to previous 1000s

Posted by "pmm-motif (via GitHub)" <gi...@apache.org>.
pmm-motif commented on issue #34587:
URL: https://github.com/apache/arrow/issues/34587#issuecomment-1473825228

   Update:
   
   I think that the methods are actually always expecting JS Date object (or epoch in milliseconds) and thus always do conversion. This might use some better documentation, I guess, but it's a separate issue. Let me close this one then


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org