Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-922989: The bignumber.js floor function has been removed in versions >= 6.0 #648

Closed
mblakley opened this issue Sep 25, 2023 · 5 comments
Assignees
Labels
enhancement The issue is a request for improvement or a new feature status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector.

Comments

@mblakley
Copy link
Contributor

  1. What version of NodeJS driver are you using?
    v1.7.0

  2. What operating system and processor architecture are you using?
    Linux - Debian Stretch AMD64 (node:14.18.1 container from docker hub)

  3. What version of NodeJS are you using?
    v14.18.1

  4. What are the component versions in the environment (npm list)?
    Relevant dependency is bignumber.js, latest version is 9.x, but this issue exists when using any bignumber.js version >= 6.0

5.Server version:
7.33.1

  1. What did you do?

Calling the convertRawTimestampTz function while pulling in a bignumber.js dependency with a version >= 6.0.0 results in the error:

/home/node/app/node_modules/snowflake-sdk/lib/connection/result/column.js:527
  var valSecBig = epochFracSecsBig.dividedBy(scaleFactor).floor();
                                                          ^
TypeError: epochFracSecsBig.dividedBy(...).floor is not a function
    at convertRawTimestampHelper (/home/node/app/node_modules/snowflake-sdk/lib/connection/result/column.js:527:59)
    at Object.convertRawTimestampNtz [as convert] (/home/node/app/node_modules/snowflake-sdk/lib/connection/result/column.js:419:10)
    at Column.extractFromRow (/home/node/app/node_modules/snowflake-sdk/lib/connection/result/column.js:774:19)
    at Column.getRowValue (/home/node/app/node_modules/snowflake-sdk/lib/connection/result/column.js:235:27)
    at Object.getColumnValue (/home/node/app/node_modules/snowflake-sdk/lib/connection/result/chunk.js:350:28)
    at externalizeRow (/home/node/app/node_modules/snowflake-sdk/lib/connection/result/row_stream.js:445:84)
    at /home/node/app/node_modules/snowflake-sdk/lib/connection/result/row_stream.js:190:26
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Release notes from bignumber.js show that the floor function was removed in version 6.0.0: https://github.com/MikeMcl/bignumber.js/blob/6f2932fe5b41e0a2a037ae3004d6562a68c70cff/CHANGELOG.md?plain=1#L113
The expected code changes to replace any calls to the floor function can be found here: MikeMcl/bignumber.js#139 (comment)

  1. What did you expect to see?
    Expected to see the bignumber object rounded down (the functionality that the floor() function should provide)

  2. Can you set logging to DEBUG and collect the logs?
    Not necessary, as this is a syntax/object usage error

  3. What is your Snowflake account identifier, if any? (Optional)

@mblakley mblakley added the bug Something isn't working label Sep 25, 2023
@github-actions github-actions bot changed the title The bignumber.js floor function has been removed in versions >= 6.0 SNOW-922989: The bignumber.js floor function has been removed in versions >= 6.0 Sep 25, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Sep 25, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage Issue is under initial triage label Sep 25, 2023
@sfc-gh-dszmolka
Copy link
Collaborator

hi and thank you for the very detailed issue submission and the PR as well ! as you noticed, at this moment snowflake-sdk requires and is compatible with bignumber.js 2.4.0, which still has the floor method. We'll take a look and thank you for your contribution !

@sfc-gh-dszmolka sfc-gh-dszmolka added status-in_progress Issue is worked on by the driver team and removed bug Something isn't working labels Sep 25, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka added bug Something isn't working enhancement The issue is a request for improvement or a new feature and removed status-triage Issue is under initial triage bug Something isn't working labels Sep 25, 2023
@sfc-gh-dszmolka
Copy link
Collaborator

We're checking how to best approach this. Perhaps bump bignumber.js all the way up if we're already upgrading it, and not stop at the 2018 version 6.0.0. Will keep this issue posted.

@mblakley
Copy link
Contributor Author

The only reason I chose v6.0 is because that's where the floor function got removed. Every version past that should be compatible with how snowflake-connector-nodejs is using it, so bumping up to the latest version should certainly work if you choose to do that. I appreciate your time, and please let me know if there's anything I can do to help!

@sfc-gh-dszmolka
Copy link
Collaborator

I see PR #649 is merged now and thus will be part of the October release, expected towards the end of the month. Thank you for your contribution !

@sfc-gh-dszmolka sfc-gh-dszmolka added status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. and removed status-in_progress Issue is worked on by the driver team labels Oct 19, 2023
@sfc-gh-dszmolka
Copy link
Collaborator

node.js driver version 1.9.1 released with the fix and is available on npm. thank you all for bearing with us !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is a request for improvement or a new feature status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector.
Projects
None yet
Development

No branches or pull requests

3 participants