-
Notifications
You must be signed in to change notification settings - Fork 197
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,11 @@ | |
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
|
||
// Forked from https://github.com/kbajalc/parquets under MIT license (Copyright (c) 2017 ironSource Ltd.) | ||
// __VERSION__ is injected by babel-plugin-version-inline | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
export const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest'; | ||
export const PARQUET_WASM_URL = 'https://unpkg.com/[email protected]/esm/arrow1_bg.wasm'; | ||
|
||
/** | ||
* Parquet File Magic String | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,7 @@ import type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-u | |
import type {ArrowTable} from '@loaders.gl/arrow'; | ||
|
||
import {parseParquetWasm} from './lib/wasm/parse-parquet-wasm'; | ||
|
||
// __VERSION__ is injected by babel-plugin-version-inline | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest'; | ||
import {VERSION, PARQUET_WASM_URL} from './lib/constants'; | ||
|
||
/** Parquet WASM loader options */ | ||
export type ParquetWasmLoaderOptions = LoaderOptions & { | ||
|
@@ -34,13 +31,16 @@ export const ParquetWasmWorkerLoader: Loader<ArrowTable, never, ParquetWasmLoade | |
options: { | ||
parquet: { | ||
type: 'arrow-table', | ||
wasmUrl: 'https://unpkg.com/[email protected]/esm2/arrow1_bg.wasm' | ||
wasmUrl: PARQUET_WASM_URL | ||
} | ||
} | ||
}; | ||
|
||
/** Parquet WASM table loader */ | ||
export const ParquetWasmLoader: LoaderWithParser<ArrowTable, never, ParquetWasmLoaderOptions> = { | ||
...ParquetWasmWorkerLoader, | ||
parse: parseParquetWasm | ||
parse(arrayBuffer: ArrayBuffer, options?: ParquetWasmLoaderOptions) { | ||
options = {parquet: {...ParquetWasmLoader.options.parquet, ...options?.parquet}, ...options}; | ||
return parseParquetWasm(arrayBuffer, options); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,16 @@ | |
|
||
import type {WriterWithEncoder} from '@loaders.gl/loader-utils'; | ||
import type {ArrowTable} from '@loaders.gl/arrow'; | ||
import {encode, ParquetWriterOptions} from './lib/wasm/encode-parquet-wasm'; | ||
import {encode} from './lib/wasm/encode-parquet-wasm'; | ||
import type {WriterOptions} from '@loaders.gl/loader-utils'; | ||
|
||
// __VERSION__ is injected by babel-plugin-version-inline | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest'; | ||
import {VERSION, PARQUET_WASM_URL} from './lib/constants'; | ||
|
||
export type ParquetWriterOptions = WriterOptions & { | ||
parquet?: { | ||
wasmUrl?: string; | ||
}; | ||
}; | ||
|
||
/** Parquet WASM writer */ | ||
export const ParquetWasmWriter: WriterWithEncoder<ArrowTable, never, ParquetWriterOptions> = { | ||
|
@@ -21,8 +26,11 @@ export const ParquetWasmWriter: WriterWithEncoder<ArrowTable, never, ParquetWrit | |
binary: true, | ||
options: { | ||
parquet: { | ||
wasmUrl: 'https://unpkg.com/[email protected]/esm2/arrow1_bg.wasm' | ||
wasmUrl: PARQUET_WASM_URL | ||
} | ||
}, | ||
encode | ||
encode(arrowTable: ArrowTable, options?: ParquetWriterOptions) { | ||
options = {parquet: {...ParquetWasmWriter.options.parquet, ...options?.parquet}, ...options}; | ||
return encode(arrowTable, options); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 originalesm2
endpoint was an undocumented hack that just stripped theimport.meta.url
line out of the generated JS bundle withsed
, which we seemed to need for bundling at the time.