mirror of
https://github.com/asadbek064/hyparquet.git
synced 2025-12-06 06:51:54 +00:00
36 lines
888 B
JavaScript
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: [],
|
|
}
|