-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parquet): restore ParquetWasm loader
- Loading branch information
Showing
19 changed files
with
137 additions
and
127 deletions.
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.