hyparquet/test/schemaTree.test.js
2024-05-23 00:07:09 -07:00

36 lines
888 B
JavaScript

import { describe, expect, it } from 'vitest'
import { parquetMetadata, parquetSchema } from '../src/hyparquet.js'
import { readFileToArrayBuffer } from './helpers.js'
describe('parquetSchema', () => {
it('parse schema tree from rowgroups.parquet', async () => {
const arrayBuffer = await readFileToArrayBuffer('test/files/rowgroups.parquet')
const metadata = parquetMetadata(arrayBuffer)
const result = parquetSchema(metadata)
expect(result).toEqual(rowgroupsSchema)
})
})
// Parquet v2 from pandas with 2 row groups
const rowgroupsSchema = {
children: [
{
children: [],
count: 1,
element: {
name: 'numbers',
repetition_type: 'OPTIONAL',
type: 'INT64',
},
path: ['numbers'],
},
],
count: 2,
element: {
name: 'schema',
num_children: 1,
repetition_type: 'REQUIRED',
},
path: [],
}