Skip to main content

Parquet writer

ParquetWriter

ParquetWriter encodes loaders.gl table data, including Arrow-backed tables, into typed columnar Parquet. GeoArrow metadata can be carried into GeoParquet schema metadata when the input describes geometry columns.

Portable output

One application shape. Many destinations.

Writers keep encoding at the edge of the pipeline. Prepare a documented category shape, choose the destination format, and let that writer own its physical layout and compression.

The application chooses the data shape; the writer chooses the bytes.

The encode path

Keep types, columns, and spatial metadata together.

The writer accepts loaders.gl tables and Arrow input, then emits Parquet columns. When geometry metadata is present, the writer can synthesize the GeoParquet schema description needed by downstream readers.

Input

Row, columnar, or Arrow table data

Output

Typed Parquet columns and row groups

Geospatial

GeoArrow metadata to GeoParquet metadata

Runtime

Wasm-backed writer with a TypeScript compatibility path

From-v3.1From-v5.0Status: Experimental

ParquetWriter accepts loaders.gl tables, including Arrow tables, and encodes them with the native TypeScript Parquet encoder.

Detailed guide

ParquetWriter details

The sections below cover usage, geospatial metadata precedence, options, and writer compatibility.

ParquetWriter supports native Arrow tables and schema-bearing row tables. The legacy ParquetJSONWriter compatibility alias has been removed. Use ParquetWriter.

import {ParquetLoader, ParquetWriter} from '@loaders.gl/tables/parquet';

Geospatial Metadata​

When ParquetWriter receives Arrow input with GeoArrow field metadata, loaders.gl synthesizes GeoParquet geo schema metadata when it is missing or invalid.

Writer precedence is:

  • valid existing GeoParquet schema.metadata.geo is preserved
  • missing or invalid GeoParquet metadata is synthesized from GeoArrow field metadata
  • geometry columns are passed through unchanged; the writer does not convert between WKB and native GeoArrow layouts in this pass

The writer currently synthesizes:

  • geoarrow.wkb -> GeoParquet encoding: "WKB"
  • native GeoArrow single-geometry encodings -> matching GeoParquet encoding names
  • primary_column from the first geometry column in schema order
  • one columns entry per detected geometry column
  • inline crs and non-planar edges where present on the GeoArrow field metadata

The writer infers geometry_types conservatively:

  • native single-geometry encodings map to their matching geometry type
  • WKB defaults to an empty geometry_types array unless more specific information is already available

The writer does not invent orientation, bbox, covering, or epoch values. Those fields are only preserved when existing GeoParquet metadata is already valid.

GeoParquet 2.0 with the TypeScript writer​

When valid geo metadata declares version 2.x and a binary column with encoding: "WKB", ParquetWriter writes that column as the native Parquet GEOMETRY logical type for planar edges or GEOGRAPHY for spherical, Vincenty, Thomas, Andoyer, or Karney edges. It carries inline PROJJSON into the logical type, uses Parquet's default OGC:CRS84 when CRS is omitted, and writes srid:0 when GeoParquet explicitly declares crs: null.

Every row group receives native GeospatialStatistics: a bounding box with independent X, Y, Z, and M handling plus the unique ISO WKB codes for XY, XYZ, XYM, and XYZM geometry families.

Without GeoParquet geo metadata, a geoarrow.wkb field is still written using native Parquet geospatial types. GeoArrow inline or authority-code CRS values are carried directly; an omitted GeoArrow CRS means unknown and is written as srid:0, rather than being silently changed to the Parquet default CRS84.

Read/Write Example​

import {load, encode} from '@loaders.gl/core';
import {ParquetLoader, ParquetWriter} from '@loaders.gl/tables/parquet';

const arrowTable = await load(url, ParquetLoader);

const parquetBuffer = await encode(arrowTable, ParquetWriter, {
core: {worker: false}
});

Options​

TypeScript writer options​

ParquetWriter accepts parquet.columnEncodings, keyed by top-level column name. It also supports adaptive or forced chunk dictionaries independently of the primary encoding. Unsupported encoding/type combinations and unknown column names are rejected instead of silently falling back.

const parquet = await encode(table, ParquetWriter, {
parquet: {
useDataPageV2: true,
pageSize: 8192,
dictionary: 'auto',
columnDictionaries: {
identifier: false
},
columnEncodings: {
temperature: 'BYTE_STREAM_SPLIT',
timestamp: 'DELTA_BINARY_PACKED',
identifier: 'DELTA_BYTE_ARRAY'
},
bloomFilter: {identifier: true},
pageIndex: {timestamp: true}
}
});

The selectable primary encodings are:

EncodingPhysical typesTypical data
PLAINAllBaseline or already-compressed values
PLAIN_DICTIONARYAllLegacy dictionary identifier for interoperability
BYTE_STREAM_SPLITINT32, INT64, FLOAT, DOUBLE, FIXED_LEN_BYTE_ARRAYFixed-width numeric values followed by compression
DELTA_BINARY_PACKEDINT32, INT64Ordered counters, timestamps, and low-delta integers
DELTA_LENGTH_BYTE_ARRAYBYTE_ARRAYVariable-width values with compressible lengths
DELTA_BYTE_ARRAYBYTE_ARRAY, FIXED_LEN_BYTE_ARRAYSorted or shared-prefix strings and binary values

Dictionary encoding is configured separately because it emits a PLAIN dictionary page followed by RLE_DICTIONARY data pages. dictionary: 'auto' uses a dictionary only when its uncompressed value payload plus index stream are smaller than the selected primary encoding. dictionary: true forces one when it fits the size limit, and false disables it. If a forced dictionary exceeds dictionaryPageSizeLimit, the complete column chunk uses its primary encoding instead of mixing incompatible dictionary domains.

See the Parquet format page for the complete read/write encoding matrix.

OptionTypeDefaultDescription
parquet.columnEncodingsRecord<string, ParquetWriterEncoding>{}Selects the primary value encoding by top-level column name for ParquetWriter.
parquet.dictionaryboolean | 'auto''auto'Enables, disables, or adaptively selects a chunk-wide dictionary.
parquet.columnDictionariesRecord<string, boolean | 'auto'>{}Overrides the dictionary policy by top-level column name.
parquet.dictionaryPageSizeLimitnumber1048576Maximum uncompressed PLAIN dictionary payload in bytes; oversized dictionaries fall back for the complete chunk.
parquet.bloomFilterboolean | Record<string, boolean>falseEmits uncompressed split-block Bloom filters for supported scalar columns, globally or by top-level column name.
parquet.pageIndexboolean | Record<string, boolean>falseEmits column and offset indexes for supported non-repeated scalar columns, globally or by top-level column name.
parquet.writeStatisticsboolean | Record<string, boolean>falseEmits standard min/max/null-count statistics for supported scalar column chunks and data pages, globally or by top-level column name.
parquet.sortingColumnsreadonly {column: string; descending?: boolean; nullsFirst?: boolean}[]undefinedDeclares the row-group sort order using top-level or dotted nested leaf names. The writer does not sort rows.
parquet.int96AsTimestampbooleanfalseEncodes INT96 input values as signed epoch-nanosecond timestamps using the canonical Julian-day representation.
parquet.writePageChecksumsbooleanfalseEmits CRC-32 checksums for TypeScript writer data and dictionary pages.
parquet.writeSizeStatisticsbooleanfalseEmits byte-array size totals and repetition/definition-level histograms for TypeScript writer column chunks.
parquet.rowGroupSizenumberimplementation defaultSets the target row count per row group for ParquetWriter.
parquet.pageSizenumber8192Sets the target shredded level-entry count per page. Boundaries remain aligned to top-level rows.
parquet.useDataPageV2booleanfalseEmits Data Page V2 from ParquetWriter.

Writer encryption​

ParquetWriter can encrypt the footer and, optionally, selected column chunks with the same footer key. Column encryption covers column metadata, dictionary/data page headers and bodies, page indexes, and Bloom-filter modules. The existing ParquetLoader can read these files, including selective range reads and worker decoding. Keys stay in the caller's keyRetriever; they are not serialized into the writer options.

const parquetBuffer = await encode(table, ParquetWriter, {
core: {worker: false},
parquet: {
encryption: {
algorithm: 'AES_GCM_CTR_V1',
encryptColumns: {identifier: true},
keyRetriever: async () => encryptionKey
}
}
});
OptionTypeDefaultDescription
parquet.encryption.algorithm'AES_GCM_V1' | 'AES_GCM_CTR_V1''AES_GCM_V1'Parquet modular-encryption algorithm used for footer and column modules.
parquet.encryption.keyMetadataUint8ArrayundefinedOpaque metadata supplied to the key retriever and stored in the file crypto metadata.
parquet.encryption.aadPrefixUint8ArrayundefinedOptional AAD prefix shared by encrypted modules.
parquet.encryption.fileUniqueUint8ArraygeneratedEight-byte file identifier used to construct module AAD.
parquet.encryption.encryptColumnsboolean | Record<string, boolean>falseEncrypt all columns or only named top-level columns with the footer key.
parquet.encryption.columnKeyMetadataRecord<string, Uint8Array>undefinedAssigns opaque key metadata per top-level column; columns use ENCRYPTION_WITH_COLUMN_KEY and may rotate independently.
parquet.encryption.keyRetrieverParquetKeyRetrieverrequiredResolves the footer key without placing key bytes in the options object.
parquet.footerSignatureParquetWriterFooterSignatureOptionsundefinedAuthenticates a plaintext footer with a 28-byte Parquet signature; mutually exclusive with encrypted footers.

Per-column keys, key rotation, and plaintext-footer signatures are opt-in. The key retriever receives the corresponding footer or column metadata and key material is never serialized into writer options.

Writer Variants​

  • Use ParquetWriter for the native TypeScript writer. It accepts plain loaders.gl tables and does not require Arrow input.
import {encode} from '@loaders.gl/core';
import {ParquetWriter} from '@loaders.gl/tables/parquet';

const parquetBuffer = await encode(table, ParquetWriter, {
core: {worker: false},
parquet: {
rowGroupSize: 1000
}
});

ParquetWriter emits multiple pages when a column chunk exceeds parquet.pageSize. A repeated row larger than the target stays intact in one page. Dictionary pages are shared by all data pages in a column chunk, and footer offsets plus encoding statistics identify the dictionary and data-page regions for other readers.

The TypeScript writer emits Parquet 2.13 LogicalType metadata for Arrow-compatible integer, date/time/timestamp, decimal, FLOAT16, and string fields. Nanosecond and unsigned 64-bit values are written without conversion through JavaScript number.

Supported Files​

The Parquet format supports a large set of data types, encodings, compressions, and encryption variants. The feature matrix tracks the stable combinations implemented by loaders.gl and the experimental or producer-specific combinations that still need interoperability coverage.

Please refer to the detailed information about which Parquet format features are supported.