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

feat(parquet): restore ParquetWasm loader #2868

Merged
merged 3 commits into from
Feb 24, 2024
Merged

feat(parquet): restore ParquetWasm loader #2868

merged 3 commits into from
Feb 24, 2024

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Jan 28, 2024

Can you try 0.6.0-beta.1 with kylebarron/parquet-wasm#382
#2781 (comment)

@kylebarron Finally getting around to this. Running into [TypeError: Cannot read properties of undefined (reading '__wbindgen_add_to_stack_pointer')]. Any thoughts?

@kylebarron
Copy link
Collaborator

[TypeError: Cannot read properties of undefined (reading '__wbindgen_add_to_stack_pointer')].

You're not initializing the wasm module. This import syntax sugar doesn't change the fact that the ESM import is async and the node import is sync. With the ESM bundle you need to await the default export.

Comment on lines 10 to 13
if (typeof initWasm === 'function') {
// @ts-expect-error
await initWasm('https://unpkg.com/[email protected]/esm/arrow1_bg.wasm');
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assuming that this file is only called from Node (as suggested by the filename), this line should never be true.

@@ -34,7 +34,7 @@ export const ParquetWasmWorkerLoader: Loader<ArrowTable, never, ParquetWasmLoade
options: {
parquet: {
type: 'arrow-table',
wasmUrl: 'https://unpkg.com/[email protected]/esm2/arrow1_bg.wasm'
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's great that esm is working; the original esm2 endpoint was an undocumented hack that just stripped the import.meta.url line out of the generated JS bundle with sed, which we seemed to need for bundling at the time.

const writerProperties = new wasm.WriterPropertiesBuilder().build();
const parquetBytes = wasm.writeParquet(arrowIPCBytes, writerProperties);
const wasmProperties = new wasm.WriterPropertiesBuilder().build();
const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Btw if you aren't passing specific properties, you don't have to pass in a second argument. https://kylebarron.dev/parquet-wasm/functions/bundler_arrow1.writeParquet.html

@ibgreen ibgreen marked this pull request as ready for review February 24, 2024 01:51
@ibgreen ibgreen merged commit 575b24a into master Feb 24, 2024
3 checks passed
@ibgreen ibgreen deleted the ib/parquet-wasm branch February 24, 2024 01:51
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.

2 participants