hyparquet/test/plan.test.js
Kenny Daniel 9a9519f0b7
Add more details to QueryPlan. (#82)
- Add metadata
 - Add rowStart and rowEnd
 - Add columns
 - Add groupStart, selectStart, selectEnd, and groupRows to GroupPlan
 - Rename ranges to fetches
 - Rename numRows to groupRows in ColumnDecoder
2025-05-25 15:21:58 -07:00

40 lines
1.1 KiB
JavaScript

import { describe, expect, it } from 'vitest'
import { parquetMetadataAsync } from '../src/hyparquet.js'
import { asyncBufferFromFile } from '../src/utils.js'
import { parquetPlan } from '../src/plan.js'
describe('parquetPlan', () => {
it('generates a query plan', async () => {
const file = await asyncBufferFromFile('test/files/page_indexed.parquet')
const metadata = await parquetMetadataAsync(file)
const plan = parquetPlan({ file, metadata })
expect(plan).toMatchObject({
metadata,
rowStart: 0,
rowEnd: 200,
fetches: [
{ startByte: 4, endByte: 1166 },
{ startByte: 1166, endByte: 2326 },
],
groups: [
{
groupRows: 100,
groupStart: 0,
ranges: [
{ startByte: 4, endByte: 832 },
{ startByte: 832, endByte: 1166 },
],
},
{
groupRows: 100,
groupStart: 100,
ranges: [
{ startByte: 1166, endByte: 1998 },
{ startByte: 1998, endByte: 2326 },
],
},
],
})
})
})