@nteract/sift 0.5.6 → 0.6.0-nightly.39864690728

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,6 +52,9 @@ const load = useCallback(() => loadTableFile(bytes), [bytes]) // Parquet or Arro
52
52
  ```
53
53
 
54
54
  Files load whole or fail; defaults are 16 MiB, 100,000 rows, and 256 columns.
55
+ Parquet can also be read by byte range through a `ByteSource` (footer first,
56
+ then one row group at a time), which drops the 16 MiB input cap; see the
57
+ embedding guide.
55
58
  CSV and TSV go through [`@nteract/sift-csv`](https://www.npmjs.com/package/@nteract/sift-csv), a separate WASM
56
59
  module that returns Arrow IPC bytes for `loadTableFile`, so apps that only open
57
60
  Parquet or Arrow do not carry the CSV parser.
@@ -111,6 +111,67 @@ paging or sampled preview.
111
111
  Lists, structs, and maps display as text. Known image structures have dedicated
112
112
  rendering.
113
113
 
114
+ ## Parquet by byte range
115
+
116
+ For Parquet files you would rather not read into memory, give Sift a
117
+ `ByteSource` instead of bytes. Sift reads the footer, then fetches each row
118
+ group's column chunks as it decodes them; the whole file is never buffered in
119
+ JS or WASM memory.
120
+
121
+ ```ts
122
+ import type { ByteSource } from '@nteract/sift'
123
+
124
+ const source: ByteSource = {
125
+ byteLength: stat.size,
126
+ // Resolve with exactly `length` bytes. The signal aborts when Sift no
127
+ // longer needs them (unmount, source change).
128
+ read: (offset, length, signal) => files.readRange(path, offset, length, { signal }),
129
+ }
130
+ ```
131
+
132
+ Back `read` with whatever the host already trusts: a file handle behind an
133
+ IPC bridge, or a URL that honors HTTP `Range`. Return a transferable
134
+ `Uint8Array`; avoid base64.
135
+
136
+ Two ways to use it:
137
+
138
+ ```tsx
139
+ // Complete or error, like loadTableFile(bytes). Resolves after every row group.
140
+ // This path passes no AbortSignal to `read`.
141
+ const data = await loadTableFile(source)
142
+
143
+ // Progressive: the table mounts after the first row group and the rest stream
144
+ // in behind the streaming indicator. Memoize `source`; a new identity reloads
145
+ // and aborts the previous source's reads.
146
+ <SiftTable source={{ kind: 'byte-source', source }} onLoadError={report} />
147
+ ```
148
+
149
+ The footer must carry the `PAR1` magic; anything else is rejected after a
150
+ single read of the file tail. `maxRows`, `maxColumns`, and `maxDecodedBytes`
151
+ apply as for bytes, from the footer and cumulatively as row groups append.
152
+ `maxBytes` does not: the file length is not the cap, retained memory is. A file
153
+ whose decoded rows exceed `maxDecodedBytes` still fails; raise the limit for
154
+ hosts with memory to spare. Rows become resident as their row group loads and
155
+ stay resident, so sort, filter, and summaries cover every loaded row.
156
+
157
+ What `maxDecodedBytes` bounds is retained Arrow memory, checked after each
158
+ decoded batch. Two guards keep transient memory near it: a footer longer than
159
+ the limit is rejected before it is read, and a row group whose compressed or
160
+ footer-declared size exceeds the remaining budget is rejected before it is
161
+ fetched. One row group's compressed bytes still pass through JS and WASM
162
+ memory while it decodes. Files with column chunks past 4 GiB are rejected at
163
+ open; the WASM reader cannot address them.
164
+
165
+ If a row group fails after the table has mounted (a read error, the decoded
166
+ limit), the rows already loaded stay on screen, the streaming indicator
167
+ settles, Sift shows the error, and `onLoadError` fires.
168
+
169
+ Only Parquet can be read this way. A `ByteSource` with `format: 'arrow-ipc'` is
170
+ read whole and goes through the bytes path with its `maxBytes` check.
171
+
172
+ `onLoadError` fires for `loader`, `url`, `byte-source`, and manifest sources
173
+ when a load fails, with the same `Error` Sift renders in its error state.
174
+
114
175
  ## Lifecycle and host controls
115
176
 
116
177
  A `TableData` instance returned by `loadTableFile` owns one WASM store. The React
@@ -131,7 +192,9 @@ responsibilities. Parquet can use a view-only mode.
131
192
 
132
193
  For already hosted data, `<SiftTable url="/data.arrow" />` and
133
194
  `<SiftTable url="/data.parquet" />` remain available. The URL/manifest paths have
134
- different loading behavior and do not inherit `loadTableFile` admission limits.
195
+ different loading behavior and do not inherit `loadTableFile` admission limits:
196
+ a Parquet URL streams row groups through the same loader as `byte-source`, with
197
+ the limits set to their maxima. A schema-only Parquet URL mounts an empty table.
135
198
  A sampled Arrow manifest must include its `summary.sampled` and included/total
136
199
  row metadata; its sorting, filtering, and summaries cover only the supplied rows.
137
200
 
@@ -40,11 +40,14 @@ Generated by `cargo about` from `about.toml` for sift-wasm.
40
40
  | const-random-macro | 0.1.16 | MIT OR Apache-2.0 | https://github.com/tkaitchuck/constrandom |
41
41
  | crc32fast | 1.5.0 | MIT OR Apache-2.0 | https://github.com/srijs/rust-crc32fast |
42
42
  | crunchy | 0.2.4 | MIT | https://github.com/eira-fransham/crunchy |
43
+ | equivalent | 1.0.2 | Apache-2.0 OR MIT | https://github.com/indexmap-rs/equivalent |
43
44
  | flatbuffers | 24.12.23 | Apache-2.0 | https://github.com/google/flatbuffers |
44
45
  | flate2 | 1.1.9 | MIT OR Apache-2.0 | https://github.com/rust-lang/flate2-rs |
45
46
  | getrandom | 0.2.17 | MIT OR Apache-2.0 | https://github.com/rust-random/getrandom |
46
47
  | half | 2.7.1 | MIT OR Apache-2.0 | https://github.com/VoidStarKat/half-rs |
47
48
  | hashbrown | 0.15.5 | MIT OR Apache-2.0 | https://github.com/rust-lang/hashbrown |
49
+ | hashbrown | 0.17.0 | MIT OR Apache-2.0 | https://github.com/rust-lang/hashbrown |
50
+ | indexmap | 2.14.0 | Apache-2.0 OR MIT | https://github.com/indexmap-rs/indexmap |
48
51
  | integer-encoding | 3.0.4 | MIT | https://github.com/dermesser/integer-encoding-rs |
49
52
  | itoa | 1.0.18 | MIT OR Apache-2.0 | https://github.com/dtolnay/itoa |
50
53
  | js-sys | 0.3.95 | MIT OR Apache-2.0 | https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/js-sys |
@@ -821,7 +824,7 @@ Apache License
821
824
 
822
825
  ### Apache License 2.0 (Apache-2.0)
823
826
 
824
- Used by: ahash@0.8.12, base64@0.22.1, bitflags@1.3.2, bitflags@2.11.1, bumpalo@3.20.2, cfg-if@1.0.4, const-random-macro@0.1.16, const-random@0.1.18, flate2@1.1.9, hashbrown@0.15.5, js-sys@0.3.95, num-bigint@0.4.6, num-complex@0.4.6, num-integer@0.1.46, num-iter@0.1.45, num-rational@0.4.2, num-traits@0.2.19, num@0.4.3, once_cell@1.21.4, regex-automata@0.4.14, regex-syntax@0.8.10, regex@1.12.3, wasm-bindgen-macro-support@0.2.118, wasm-bindgen-macro@0.2.118, wasm-bindgen-shared@0.2.118, wasm-bindgen@0.2.118
827
+ Used by: ahash@0.8.12, base64@0.22.1, bitflags@1.3.2, bitflags@2.11.1, bumpalo@3.20.2, cfg-if@1.0.4, const-random-macro@0.1.16, const-random@0.1.18, equivalent@1.0.2, flate2@1.1.9, hashbrown@0.15.5, hashbrown@0.17.0, indexmap@2.14.0, js-sys@0.3.95, num-bigint@0.4.6, num-complex@0.4.6, num-integer@0.1.46, num-iter@0.1.45, num-rational@0.4.2, num-traits@0.2.19, num@0.4.3, once_cell@1.21.4, regex-automata@0.4.14, regex-syntax@0.8.10, regex@1.12.3, wasm-bindgen-macro-support@0.2.118, wasm-bindgen-macro@0.2.118, wasm-bindgen-shared@0.2.118, wasm-bindgen@0.2.118
825
828
 
826
829
  ```
827
830
  Apache License