Skip to content

fix(visitor): dispatch on DataType from another copy - #500

Open
kentkwu wants to merge 1 commit into
apache:mainfrom
kentkwu:fix/visitor-cross-copy-datatype
Open

kentkwu wants to merge 1 commit into
apache:mainfrom
kentkwu:fix/visitor-cross-copy-datatype

Conversation

@kentkwu

@kentkwu kentkwu commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

What's Changed

getVisitFn used instanceof DataType, which fails for a type created by another copy of the library, such as the CommonJS and ES module builds loaded side by side. The visitor fell through to Type.NONE, so the IPC writer silently wrote a stream with no types and empty bodies.

Applies a fix to use DataType.isDataType() introduced in #377, which works across copies, and adds a test that writes tables through a second copy of the library.

Closes #496

getVisitFn used `instanceof DataType`, which fails for a type created
by another copy of the library, such as a duplicate install or the
CommonJS and ES module builds loaded together. The visitor fell
through to Type.NONE, so the IPC writer silently wrote a stream with
no types and empty bodies.

Use DataType.isDataType(), which works across copies, and add a test
that writes tables through a second copy of the library.

Fixes apache#496
@ianmcook

ianmcook commented Oct 7, 2026

Copy link
Copy Markdown
Member

Looks good to me!

A couple of nits found with help from Claude Opus 5.5:

  • The as any casts in the test aren't needed. Other has type typeof Arrow, and tsc passes with the casts removed.
  • This is the first test in the repo to import @jest/globals. That package isn't a declared devDependency and only resolves because jest depends on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPC writer silently writes a corrupt stream for a Table from another copy of apache-arrow

2 participants