|
36 | 36 | "id": "b23746ca", |
37 | 37 | "metadata": { |
38 | 38 | "ExecuteTime": { |
39 | | - "end_time": "2026-04-19T09:26:14.791545Z", |
40 | | - "start_time": "2026-04-19T09:26:11.855205Z" |
| 39 | + "end_time": "2026-05-06T07:51:01.883922Z", |
| 40 | + "start_time": "2026-05-06T07:51:00.823273Z" |
41 | 41 | } |
42 | 42 | }, |
43 | 43 | "outputs": [ |
|
98 | 98 | "id": "d9411a66072ed12c", |
99 | 99 | "metadata": { |
100 | 100 | "ExecuteTime": { |
101 | | - "end_time": "2026-04-19T09:26:14.825272Z", |
102 | | - "start_time": "2026-04-19T09:26:14.793048Z" |
| 101 | + "end_time": "2026-05-06T07:51:01.930426Z", |
| 102 | + "start_time": "2026-05-06T07:51:01.897273Z" |
103 | 103 | } |
104 | 104 | }, |
105 | 105 | "outputs": [ |
|
132 | 132 | "\n", |
133 | 133 | "Call `create_index(col_name)` to build a bucket index on a column. Pass `kind=...` to choose another index kind, including `blosc2.IndexKind.OPSI` for tunable iterative ordering or `blosc2.IndexKind.FULL` for globally sorted indexes that can also support ordered reuse. OPSI is a separate exact-filtering index kind, not a slower way to build a `FULL`/CSI index; its build effort is controlled by `optlevel` or the explicit `opsi_max_cycles` keyword.\n", |
134 | 134 | "\n", |
135 | | - "The returned `CTableIndex` handle shows the column name, kind, and whether the index is stale.\n" |
| 135 | + "The returned `Index` handle shows the column name, kind, and whether the index is stale. Use `storage_stats()` to inspect the total `(nbytes, cbytes, cratio)` for the index payload.\n" |
136 | 136 | ] |
137 | 137 | }, |
138 | 138 | { |
|
141 | 141 | "id": "2ac1f281", |
142 | 142 | "metadata": { |
143 | 143 | "ExecuteTime": { |
144 | | - "end_time": "2026-04-19T09:26:14.869481Z", |
145 | | - "start_time": "2026-04-19T09:26:14.826650Z" |
| 144 | + "end_time": "2026-05-06T07:51:01.981307Z", |
| 145 | + "start_time": "2026-05-06T07:51:01.934008Z" |
146 | 146 | } |
147 | 147 | }, |
148 | 148 | "outputs": [ |
149 | 149 | { |
150 | 150 | "name": "stdout", |
151 | 151 | "output_type": "stream", |
152 | 152 | "text": [ |
153 | | - "<CTableIndex col='sensor_id' kind='bucket' name='__self__'>\n", |
| 153 | + "Index(kind='bucket', col_name='sensor_id', name='__self__', stale=False)\n", |
154 | 154 | "stale? False\n", |
155 | | - "all indexes: [<CTableIndex col='sensor_id' kind='bucket' name='__self__'>]\n" |
| 155 | + "storage stats: (6292289, 6333, 993.5716090320543)\n", |
| 156 | + "all indexes: [Index(kind='bucket', col_name='sensor_id', name='__self__', stale=False)]\n" |
156 | 157 | ] |
157 | 158 | } |
158 | 159 | ], |
159 | 160 | "source": [ |
160 | 161 | "idx = t.create_index(\"sensor_id\")\n", |
161 | 162 | "print(idx)\n", |
162 | 163 | "print(\"stale?\", idx.stale)\n", |
| 164 | + "print(\"storage stats:\", idx.storage_stats())\n", |
163 | 165 | "print(\"all indexes:\", t.indexes)" |
164 | 166 | ] |
165 | 167 | }, |
|
180 | 182 | "id": "dcc2dc87", |
181 | 183 | "metadata": { |
182 | 184 | "ExecuteTime": { |
183 | | - "end_time": "2026-04-19T09:26:14.945997Z", |
184 | | - "start_time": "2026-04-19T09:26:14.870232Z" |
| 185 | + "end_time": "2026-05-06T07:51:02.066579Z", |
| 186 | + "start_time": "2026-05-06T07:51:01.986232Z" |
185 | 187 | } |
186 | 188 | }, |
187 | 189 | "outputs": [ |
|
218 | 220 | "id": "b0132381", |
219 | 221 | "metadata": { |
220 | 222 | "ExecuteTime": { |
221 | | - "end_time": "2026-04-19T09:26:14.973150Z", |
222 | | - "start_time": "2026-04-19T09:26:14.946925Z" |
| 223 | + "end_time": "2026-05-06T07:51:02.100252Z", |
| 224 | + "start_time": "2026-05-06T07:51:02.076491Z" |
223 | 225 | } |
224 | 226 | }, |
225 | 227 | "outputs": [ |
|
261 | 263 | "id": "dc4d2897", |
262 | 264 | "metadata": { |
263 | 265 | "ExecuteTime": { |
264 | | - "end_time": "2026-04-19T09:26:15.018004Z", |
265 | | - "start_time": "2026-04-19T09:26:14.975125Z" |
| 266 | + "end_time": "2026-05-06T07:51:02.173294Z", |
| 267 | + "start_time": "2026-05-06T07:51:02.110489Z" |
266 | 268 | } |
267 | 269 | }, |
268 | 270 | "outputs": [ |
|
299 | 301 | "id": "e1583b4f", |
300 | 302 | "metadata": { |
301 | 303 | "ExecuteTime": { |
302 | | - "end_time": "2026-04-19T09:26:15.034449Z", |
303 | | - "start_time": "2026-04-19T09:26:15.018681Z" |
| 304 | + "end_time": "2026-05-06T07:51:02.210048Z", |
| 305 | + "start_time": "2026-05-06T07:51:02.187084Z" |
304 | 306 | } |
305 | 307 | }, |
306 | 308 | "outputs": [ |
|
333 | 335 | "id": "85d42133", |
334 | 336 | "metadata": { |
335 | 337 | "ExecuteTime": { |
336 | | - "end_time": "2026-04-19T09:26:16.491396Z", |
337 | | - "start_time": "2026-04-19T09:26:15.035139Z" |
| 338 | + "end_time": "2026-05-06T07:51:03.134956Z", |
| 339 | + "start_time": "2026-05-06T07:51:02.213213Z" |
338 | 340 | } |
339 | 341 | }, |
340 | 342 | "outputs": [ |
341 | 343 | { |
342 | 344 | "name": "stdout", |
343 | 345 | "output_type": "stream", |
344 | 346 | "text": [ |
345 | | - "Created: <CTableIndex col='sensor_id' kind='bucket' name='__self__'>\n", |
346 | | - "Sidecar files: 7\n", |
| 347 | + "Created: Index(kind='bucket', col_name='sensor_id', name='__self__', stale=False)\n", |
| 348 | + "Storage stats: (12583745, 7788, 1615.7864663585003)\n", |
347 | 349 | "Rows > 280 (before close): 19\n" |
348 | 350 | ] |
349 | 351 | } |
|
365 | 367 | "pidx = pt.create_index(\"sensor_id\")\n", |
366 | 368 | "print(\"Created:\", pidx)\n", |
367 | 369 | "\n", |
368 | | - "# Sidecar files\n", |
369 | | - "index_dir = Path(path) / \"_indexes\" / \"sensor_id\"\n", |
370 | | - "print(\"Sidecar files:\", len(list(index_dir.glob(\"**/*.b2nd\"))))\n", |
| 370 | + "# Storage usage for all index sidecars\n", |
| 371 | + "print(\"Storage stats:\", pidx.storage_stats())\n", |
371 | 372 | "\n", |
372 | 373 | "# Query before close\n", |
373 | 374 | "r1 = pt.where(pt[\"sensor_id\"] > 280)\n", |
|
380 | 381 | "id": "149ddba5", |
381 | 382 | "metadata": { |
382 | 383 | "ExecuteTime": { |
383 | | - "end_time": "2026-04-19T09:26:16.626568Z", |
384 | | - "start_time": "2026-04-19T09:26:16.511857Z" |
| 384 | + "end_time": "2026-05-06T07:51:03.222744Z", |
| 385 | + "start_time": "2026-05-06T07:51:03.167571Z" |
385 | 386 | } |
386 | 387 | }, |
387 | 388 | "outputs": [ |
388 | 389 | { |
389 | 390 | "name": "stdout", |
390 | 391 | "output_type": "stream", |
391 | 392 | "text": [ |
392 | | - "Indexes after reopen: [<CTableIndex col='sensor_id' kind='bucket' name='__self__'>]\n", |
| 393 | + "Indexes after reopen: [Index(kind='bucket', col_name='sensor_id', name='__self__', stale=False)]\n", |
| 394 | + "Storage stats after reopen: (12583745, 7788, 1615.7864663585003)\n", |
393 | 395 | "Rows > 280 (after reopen): 19\n", |
394 | 396 | "Results match ✓\n" |
395 | 397 | ] |
396 | | - }, |
397 | | - { |
398 | | - "name": "stderr", |
399 | | - "output_type": "stream", |
400 | | - "text": [ |
401 | | - "/var/folders/r3/bycghmsx079bmglqt_2xmlt00000gn/T/ipykernel_81567/2229258138.py:3: FutureWarning: blosc2.open() currently defaults to mode='a', but this will change to mode='r' in a future release. Pass mode='a' explicitly to keep writable behavior, or mode='r' for read-only access.\n", |
402 | | - " pt2 = blosc2.open(path)\n" |
403 | | - ] |
404 | 398 | } |
405 | 399 | ], |
406 | 400 | "source": [ |
407 | 401 | "# Close and reopen — catalog is preserved\n", |
408 | 402 | "del pt\n", |
409 | | - "pt2 = blosc2.open(path)\n", |
| 403 | + "pt2 = blosc2.open(path, mode=\"r\")\n", |
410 | 404 | "\n", |
411 | 405 | "print(\"Indexes after reopen:\", pt2.indexes)\n", |
| 406 | + "print(\"Storage stats after reopen:\", pt2.index(\"sensor_id\").storage_stats())\n", |
412 | 407 | "\n", |
413 | 408 | "r2 = pt2.where(pt2[\"sensor_id\"] > 280)\n", |
414 | 409 | "print(\"Rows > 280 (after reopen):\", len(r2))\n", |
|
438 | 433 | "id": "83db418b", |
439 | 434 | "metadata": { |
440 | 435 | "ExecuteTime": { |
441 | | - "end_time": "2026-04-19T09:26:16.914246Z", |
442 | | - "start_time": "2026-04-19T09:26:16.629760Z" |
| 436 | + "end_time": "2026-05-06T07:51:03.352544Z", |
| 437 | + "start_time": "2026-05-06T07:51:03.226079Z" |
443 | 438 | } |
444 | 439 | }, |
445 | 440 | "outputs": [ |
|
505 | 500 | "id": "363827fec805190a", |
506 | 501 | "metadata": { |
507 | 502 | "ExecuteTime": { |
508 | | - "end_time": "2026-04-19T09:26:16.924330Z", |
509 | | - "start_time": "2026-04-19T09:26:16.915076Z" |
| 503 | + "end_time": "2026-05-06T07:51:03.366566Z", |
| 504 | + "start_time": "2026-05-06T07:51:03.353982Z" |
510 | 505 | } |
511 | 506 | }, |
512 | 507 | "outputs": [], |
|
0 commit comments