Skip to content

Commit 0e5baec

Browse files
authored
upgrade hightable (#162)
1 parent 52f812f commit 0e5baec

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"overrides": {
1616
"highlight.js": "11.11.1",
17-
"hightable": "0.10.0",
17+
"hightable": "0.11.0",
1818
"hyparquet": "1.8.4",
1919
"hyparquet-compressors": "1.0.0",
2020
"react": "18.3.1",

packages/cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hyperparam",
3-
"version": "0.2.22",
3+
"version": "0.2.23",
44
"description": "Hyperparam CLI",
55
"author": "Hyperparam",
66
"homepage": "https://hyperparam.app",
@@ -28,9 +28,9 @@
2828
"typecheck": "tsc"
2929
},
3030
"dependencies": {
31-
"@hyparam/components": "0.1.18",
31+
"@hyparam/components": "0.1.19",
3232
"highlight.js": "11.11.1",
33-
"hightable": "0.10.0",
33+
"hightable": "0.11.0",
3434
"react": "18.3.1",
3535
"react-dom": "18.3.1"
3636
},

packages/components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hyparam/components",
3-
"version": "0.1.18",
3+
"version": "0.1.19",
44
"description": "React components for hyparam apps",
55
"keywords": [
66
"component",
@@ -40,7 +40,7 @@
4040
"typecheck": "tsc"
4141
},
4242
"dependencies": {
43-
"hightable": "0.10.0",
43+
"hightable": "0.11.0",
4444
"hyparquet": "1.8.4",
4545
"hyparquet-compressors": "1.0.0"
4646
},

packages/components/src/components/Cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function CellView({ source, row, col, config }: CellProps) {
4444
const metadata = await parquetMetadataAsync(asyncBuffer)
4545
setProgress(0.75)
4646
const df = parquetDataFrame(from, metadata)
47-
const asyncRows = df.rows(row, row + 1)
47+
const asyncRows = df.rows({ start: row, end: row + 1 })
4848
if (asyncRows.length !== 1) {
4949
throw new Error(`Expected 1 row, got ${asyncRows.length}`)
5050
}

packages/components/src/components/viewers/CellPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function CellPanel({ df, row, col, setProgress, setError, onClose
2222
async function loadCellData() {
2323
try {
2424
setProgress(0.5)
25-
const asyncRows = df.rows(row, row + 1)
25+
const asyncRows = df.rows({ start: row, end: row + 1 })
2626
if (asyncRows.length !== 1) {
2727
throw new Error(`Expected 1 row, got ${asyncRows.length}`)
2828
}

packages/components/src/lib/tableProvider.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,34 +53,34 @@ export function parquetDataFrame(from: AsyncBufferFrom, metadata: FileMetaData):
5353
return {
5454
header,
5555
numRows: Number(metadata.num_rows),
56-
rows(rowStart: number, rowEnd: number, orderBy?: string) {
56+
rows({ start, end, orderBy }: { start: number, end: number, orderBy?: string}) {
5757
if (orderBy) {
58-
const numRows = rowEnd - rowStart
58+
const numRows = end - start
5959
const wrapped = new Array(numRows).fill(null).map(() => resolvableRow(header))
6060

6161
getSortIndex(orderBy).then(indices => {
6262
// Compute row groups to fetch
63-
for (const index of indices.slice(rowStart, rowEnd)) {
63+
for (const index of indices.slice(start, end)) {
6464
const groupIndex = groupEnds.findIndex(end => index < end)
6565
fetchRowGroup(groupIndex)
6666
}
6767

6868
// Re-assemble data in sorted order into wrapped
69-
for (let i = rowStart; i < rowEnd; i++) {
69+
for (let i = start; i < end; i++) {
7070
const index = indices[i]
7171
const row = data[index]
7272
if (row === undefined) {
7373
throw new Error('Row not fetched')
7474
}
7575
const { cells } = row
76-
wrapped[i - rowStart].index.resolve(index)
76+
wrapped[i - start].index.resolve(index)
7777
for (const key of header) {
7878
if (key in cells) {
7979
// TODO(SL): should we remove this check? It makes sense only if header change
8080
// but if so, I guess we will have more issues
8181
cells[key]
8282
.then((value: unknown) => {
83-
wrapped[i - rowStart]?.cells[key].resolve(value)
83+
wrapped[i - start]?.cells[key].resolve(value)
8484
})
8585
.catch((error: unknown) => {
8686
console.error('Error resolving sorted row', error)
@@ -99,17 +99,18 @@ export function parquetDataFrame(from: AsyncBufferFrom, metadata: FileMetaData):
9999
} else {
100100
for (let i = 0; i < groups.length; i++) {
101101
const groupStart = groupEnds[i - 1] || 0
102-
if (rowStart < groupEnds[i] && rowEnd > groupStart) {
102+
if (start < groupEnds[i] && end > groupStart) {
103103
fetchRowGroup(i)
104104
}
105105
}
106-
const wrapped = data.slice(rowStart, rowEnd)
106+
const wrapped = data.slice(start, end)
107107
if (wrapped.some(row => row === undefined)) {
108108
throw new Error('Row not fetched')
109109
}
110110
return wrapped as ResolvableRow[]
111111
}
112112
},
113113
sortable: true,
114+
// TODO(SL): implement getColumn({column, start, end}): any[]
114115
}
115116
}

0 commit comments

Comments
 (0)