Repository navigation
Commit 48b69d2
client: drive aggregate and COPY functions
The Python Client wrapped bind/init and the buffered RPCs, but nothing
else: all 12 aggregate RPCs and catalog_copy_from_formats were recorded
as NotExposed in the protocol inventory, so no Python test could reach
them. Close the gap against the C++ extension as the reference.
Aggregates (vgi/client/aggregate.py) mirror the drive loop in
vgi_aggregate_function_impl.cpp across three surfaces:
* aggregate_function() keys groups client-side in first-seen order
(DuckDB's order), pumps batches through aggregate_update, finalizes
in chunks, and returns group keys + results as one RecordBatch.
* aggregate_session() is the raw surface with caller-allocated group
ids -- update/combine/finalize/destroy plus the window RPCs -- and
destroys the execution on exit, including on exception.
* aggregate_streaming() drives the streaming-partitioned
open/chunk/close protocol, resolving output_schema with a probe bind
exactly as the extension does.
Wire shapes match C++: __vgi_group_id prepended as column 0, the
(source_group_id, target_group_id) merge batch, the one-column group_id
batch, and the packed filter_mask / frame_stats / all_valid window
encodings.
COPY reuses the existing drivers rather than adding new ones, as it does
on the C++ side: copy_from() is table_function plus a CopyFromContext,
copy_to() is table_buffering_function plus a CopyToContext with no Source
phase, and copy_formats() is the discovery step that turns a FORMAT name
into the handler to invoke. table_buffering_function gains an
input_schema override so an empty COPY still binds with the source
schema -- the header-row case, which peeking the first batch cannot
serve.
ClientError moves to vgi/client/errors.py so the driver modules can raise
it without importing the module that imports them; vgi.client.client
re-exports it, so existing imports are unchanged.
157 new tests run against the real fixture worker over all three
transports. One is pinned to subprocess: reaching the "not a COPY-TO
writer" guard means running the buffered Source phase, which
HttpStreamSession does not implement -- a pre-existing gap unrelated to
COPY, since a CopyToFunction returns no finalize keys.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 1c84c2e commit 48b69d2
12 files changed
Lines changed: 2074 additions & 136 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
336 | 380 | | |
337 | 381 | | |
338 | 382 | | |
| |||
386 | 430 | | |
387 | 431 | | |
388 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
389 | 455 | | |
390 | 456 | | |
391 | 457 | | |
| |||
0 commit comments