Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Oct 7, 2023
1 parent 499c01d commit 9708869
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/parquet/src/lib/parsers/parse-parquet-to-columns.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// loaders.gl, MIT license

import {ColumnarTable, ColumnarTableBatch, Schema} from '@loaders.gl/schema';
import {makeReadableFile} from '@loaders.gl/loader-utils';
import {BlobFile} from '@loaders.gl/loader-utils';
import type {ParquetLoaderOptions} from '../../parquet-loader';
import {ParquetReader} from '../../parquetjs/parser/parquet-reader';
import {ParquetRowGroup} from '../../parquetjs/schema/declare';
Expand All @@ -16,7 +16,7 @@ export async function parseParquetInColumns(
): Promise<ColumnarTable> {
installBufferPolyfill();
const blob = new Blob([arrayBuffer]);
const file = makeReadableFile(blob);
const file = new BlobFile(blob);
const reader = new ParquetReader(file);

for await (const batch of parseParquetFileInColumnarBatches(reader, options)) {
Expand Down
4 changes: 2 additions & 2 deletions modules/parquet/src/lib/parsers/parse-parquet-to-rows.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import type {LoaderWithParser, Loader, LoaderOptions} from '@loaders.gl/loader-utils';
// import {ColumnarTableBatch} from '@loaders.gl/schema';
import {makeReadableFile} from '@loaders.gl/loader-utils';
import {BlobFile} from '@loaders.gl/loader-utils';
import {GeoJSONTable, ObjectRowTable, ObjectRowTableBatch} from '@loaders.gl/schema';
import type {ParquetLoaderOptions} from '../../parquet-loader';
import type {ParquetRow} from '../../parquetjs/schema/declare';
Expand All @@ -16,7 +16,7 @@ export async function parseParquet(
installBufferPolyfill();

const blob = new Blob([arrayBuffer]);
const file = makeReadableFile(blob);
const file = new BlobFile(blob);
const reader = new ParquetReader(file, {
preserveBinary: options?.parquet?.preserveBinary
});
Expand Down
3 changes: 2 additions & 1 deletion modules/parquet/src/parquetjs/parser/parquet-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ export class ParquetReader {

/** Metadata is stored in the footer */
async readHeader(): Promise<void> {
const buffer = await this.file.read(0, PARQUET_MAGIC.length);
const arrayBuffer = await this.file.read(0, PARQUET_MAGIC.length);
const buffer = Buffer.from(arrayBuffer);
const magic = buffer.toString();
switch (magic) {
case PARQUET_MAGIC:
Expand Down

0 comments on commit 9708869

Please sign in to comment.