@dobesv/parquets
Version:
TypeScript implementation of the Parquet file format, based on parquet.js
43 lines (42 loc) • 1.66 kB
TypeScript
import { FieldDefinition, ParquetBuffer, ParquetCompression, ParquetField, ParquetRecord, SchemaDefinition } from './declare';
import { ParquetWriteBuffer } from './shred';
/**
* A parquet file schema
*/
export declare class ParquetSchema {
schema: Record<string, FieldDefinition>;
fields: Record<string, ParquetField>;
fieldList: ParquetField[];
/**
* Create a new schema from a JSON schema definition
*/
constructor(schema: SchemaDefinition);
/**
* Retrieve a field definition
*
* If a string is provided it will be split using comma as a separator to
* give the field path to look for.
*
* The code assumes the given field path is valid and a TypeError will
* be thrown as a side effect if the field path isn't found in the schema.
*/
findField(path: string): ParquetField;
findField(path: string[]): ParquetField;
/**
* Retrieve a field definition and all the field's ancestors
*
* If a string is provided it will be split using comma as a separator to
* give the field path to look for.
*
* The resulting array will have one ParquetField per segment of the
* provided path.
*
* The code assumes the given field path is valid and a TypeError will
* be thrown as a side effect if the field path isn't found in the schema.
*/
findFieldBranch(path: string): ParquetField[];
findFieldBranch(path: string[]): ParquetField[];
shredRecord(record: ParquetRecord, buffer: ParquetWriteBuffer): void;
materializeRecords(buffer: ParquetBuffer): ParquetRecord[];
compress(type: ParquetCompression): this;
}