Skip to content

Conversation

@shiavm006
Copy link
Contributor

Description

What is the purpose of this pull request?

This pull request:

Fixes a crash in @stdlib/utils/dsv/base/parse when a TypedArray is provided as the rowBuffer option. The _setField method was calling buf.push() which throws a TypeError since TypedArrays do not have a push method. added the fix suggested in the existing FIXME comment by using @stdlib/utils/push, which supports arrays, typed arrays, and array-like objects.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • No related issue filed - this was discovered during code review of the codebase.

Questions

Any questions for reviewers of this pull request?

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jan 18, 2026
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Jan 18, 2026

Coverage Report

Package Statements Branches Functions Lines
utils/dsv/base/parse $\color{red}3522/3872$
$\color{green}+0.01%$
$\color{red}315/389$
$\color{green}+0.00%$
$\color{red}62/69$
$\color{green}+0.00%$
$\color{red}3522/3872$
$\color{green}+0.01%$

The above coverage report was generated for the changes in this PR.

@shiavm006
Copy link
Contributor Author

cc @kgryte

setReadOnly( Parser.prototype, '_setField', function set( value, idx ) {
var buf = this._rowBuffer;

// FIXME: as buffer may be provided from userland, use `set` accessor and consider using `@stdlib/utils/push` to allow support of dynamically resizing fixed length buffers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should not be removed, as the proposed changes only partially resolve what is described.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also not clear whether we want to use utils/push here. The reason why this was not done originally was due to performance concerns. As such, I am not convinced that this PR should move forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean the performance concern make sense it is low i mean should we go with caching the buffer type at initialization and using a fast path for arrays?
what u think on it ?

@kgryte kgryte changed the title fix: use @stdlib/utils/push for typed array support in DSV parser refactor: add typed array support in DSV parser Jan 26, 2026
@kgryte kgryte added Needs Discussion Needs further discussion. and removed Needs Review A pull request which needs code review. labels Jan 26, 2026
Restore the FIXME comment as requested by reviewer. The comment
notes that while @stdlib/utils/push is now used to support TypedArrays,
the set accessor for _rowBuffer still needs to be implemented.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Discussion Needs further discussion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants