Skip to content

Commit d4bfa47

Browse files
committed
Add orderBy and filter to parquetQueryWorker
1 parent 6b16362 commit d4bfa47

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

eslint.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import typescript from 'typescript-eslint'
99
export default typescript.config(
1010
{ ignores: ['coverage/', 'dist/', 'lib/'] },
1111
{
12-
extends: [javascript.configs.recommended, ...typescript.configs.strictTypeChecked, ...typescript.configs.stylisticTypeChecked],
12+
extends: [
13+
javascript.configs.recommended,
14+
...typescript.configs.strictTypeChecked,
15+
...typescript.configs.stylisticTypeChecked,
16+
],
1317
files: ['**/*.{ts,tsx,js}'],
1418
languageOptions: {
1519
globals: globals.browser,
@@ -49,6 +53,7 @@ export default typescript.config(
4953
'func-style': ['error', 'declaration'],
5054
indent: ['error', 2, { SwitchCase: 1 }],
5155
'key-spacing': 'error',
56+
'keyword-spacing': 'error',
5257
'no-constant-condition': 'off',
5358
'no-extra-parens': 'error',
5459
'no-multi-spaces': 'error',

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,25 @@
6464
},
6565
"devDependencies": {
6666
"@eslint/js": "9.29.0",
67-
"@storybook/react-vite": "9.0.12",
67+
"@storybook/react-vite": "9.0.13",
6868
"@testing-library/react": "16.3.0",
69-
"@types/node": "24.0.3",
69+
"@types/node": "24.0.4",
7070
"@types/react": "19.1.8",
7171
"@types/react-dom": "19.1.6",
72-
"@vitejs/plugin-react": "4.5.2",
72+
"@vitejs/plugin-react": "4.6.0",
7373
"@vitest/coverage-v8": "3.2.4",
7474
"eslint": "9.29.0",
7575
"eslint-plugin-react": "7.37.5",
7676
"eslint-plugin-react-hooks": "5.2.0",
7777
"eslint-plugin-react-refresh": "0.4.20",
78-
"eslint-plugin-storybook": "9.0.12",
78+
"eslint-plugin-storybook": "9.0.13",
7979
"globals": "16.2.0",
8080
"jsdom": "26.1.0",
8181
"nodemon": "3.1.10",
8282
"npm-run-all": "4.1.5",
83-
"storybook": "9.0.12",
83+
"storybook": "9.0.13",
8484
"typescript": "5.8.3",
85-
"typescript-eslint": "8.34.1",
85+
"typescript-eslint": "8.35.0",
8686
"vite": "6.3.5",
8787
"vitest": "3.2.4"
8888
},

src/lib/workers/parquetWorker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ self.onmessage = async ({ data }: { data: ClientMessage }) => {
5151
postErrorMessage({ error: error as Error, queryId })
5252
}
5353
} else {
54-
const { rowStart, rowEnd, chunks } = data
54+
const { rowStart, rowEnd, orderBy, filter, chunks } = data
5555
const onChunk = chunks ? (chunk: ColumnData) => { postChunkMessage({ chunk, queryId }) } : undefined
5656
try {
57-
const result = await parquetQuery({ metadata, file, rowStart, rowEnd, compressors, onChunk })
57+
const result = await parquetQuery({ metadata, file, rowStart, rowEnd, orderBy, filter, compressors, onChunk })
5858
postResultMessage({ result, queryId })
5959
} catch (error) {
6060
postErrorMessage({ error: error as Error, queryId })

src/lib/workers/parquetWorkerClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ParquetWorker from './parquetWorker?worker&inline'
22
/// ^ the worker is bundled with the main thread code (inline) which is easier for users to import
33
/// (no need to copy the worker file to the right place)
4-
import { ColumnData } from 'hyparquet'
4+
import type { ColumnData } from 'hyparquet'
55
import type { Cells, ColumnRanksClientMessage, ColumnRanksWorkerMessage, ColumnRanksWorkerOptions, QueryClientMessage, QueryWorkerMessage, QueryWorkerOptions } from './types.js'
66

77
let worker: Worker | undefined
@@ -66,7 +66,7 @@ function getWorker() {
6666
* Instead of taking an AsyncBuffer, it takes a AsyncBufferFrom, because it needs
6767
* to be serialized to the worker.
6868
*/
69-
export function parquetQueryWorker({ metadata, from, rowStart, rowEnd, onChunk }: QueryWorkerOptions): Promise<Cells[]> {
69+
export function parquetQueryWorker({ metadata, from, rowStart, rowEnd, orderBy, filter, onChunk }: QueryWorkerOptions): Promise<Cells[]> {
7070
// TODO(SL) Support passing columns?
7171
return new Promise((resolve, reject) => {
7272
const queryId = nextQueryId++
@@ -75,7 +75,7 @@ export function parquetQueryWorker({ metadata, from, rowStart, rowEnd, onChunk }
7575

7676
// If caller provided an onChunk callback, worker will send chunks as they are parsed
7777
const chunks = onChunk !== undefined
78-
const message: QueryClientMessage = { queryId, metadata, from, rowStart, rowEnd, chunks, kind: 'query' }
78+
const message: QueryClientMessage = { queryId, metadata, from, rowStart, rowEnd, orderBy, filter, chunks, kind: 'query' }
7979
worker.postMessage(message)
8080
})
8181
}

src/lib/workers/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ColumnData, FileMetaData } from 'hyparquet'
1+
import type { ColumnData, FileMetaData } from 'hyparquet'
2+
import type { ParquetQueryFilter } from 'hyparquet/src/types.js'
23

34
// Serializable constructors for AsyncBuffers
45
interface AsyncBufferFromFile {
@@ -29,6 +30,8 @@ export interface ErrorMessage extends Message {
2930
export interface QueryWorkerOptions extends CommonWorkerOptions {
3031
rowStart?: number,
3132
rowEnd?: number,
33+
orderBy?: string,
34+
filter?: ParquetQueryFilter,
3235
onChunk?: (chunk: ColumnData) => void
3336
}
3437
export interface QueryClientMessage extends QueryWorkerOptions, Message {

0 commit comments

Comments
 (0)