Implement copy_to_get_written_statistics for DuckDB COPY function#7821
Open
vortex-claude[bot] wants to merge 3 commits intodevelopfrom
Open
Implement copy_to_get_written_statistics for DuckDB COPY function#7821vortex-claude[bot] wants to merge 3 commits intodevelopfrom
vortex-claude[bot] wants to merge 3 commits intodevelopfrom
Conversation
Implements the copy_to_get_written_statistics callback across the full C/C++/Rust stack, enabling duck-lake (and similar table-format) layers to collect per-file write statistics (row_count, file_size_bytes) after a COPY TO operation completes. Changes: - Add duckdb_vx_written_statistics_t C struct and optional copy_to_get_written_statistics callback (returning bool) to the vtable in copy_function.h - Bridge the callback through c_get_written_statistics in copy_function.cpp, which converts the C struct into a DuckDB vector<Value> STRUCT; returns an empty vector when the callback returns false (no stats available) - Add WrittenStatistics type and get_written_statistics trait method to the CopyFunction trait with a default no-op implementation - Add copy_to_get_written_statistics_callback shim in callback.rs - Store WriteSummary in GlobalState after copy_to_finalize and implement get_written_statistics for VortexCopyFunction to expose row_count and file_size_bytes Co-authored-by: Nicholas Gates <gatesn@users.noreply.github.com> Signed-off-by: "Claude" <claude@anthropic.com>
Contributor
|
@claude fix the CI, and update AGENTS.md to include the necessary pre-commit checks to avoid this in the future |
Author
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
1 similar comment
Author
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
The C++ shim returned vector<Value> from c_get_written_statistics, but DuckDB's copy_to_get_written_statistics_t typedef is a void-returning callback that fills a CopyFunctionFileStatistics out-parameter. This caused the C++ build to fail in any job that links vortex-duckdb. Also re-run nightly rustfmt over copy.rs and copy_function/mod.rs to match CI's nightly fmt check, and add the lessons (verify FFI signatures against bundled DuckDB headers; always run nightly fmt) to AGENTS.md. Signed-off-by: Nicholas Gates <nick@spiraldb.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Nicholas Gates <nick@nickgates.com>
…ions Move the lessons learned out of the "Common Mistakes" do-not list into a dedicated "Native FFI in vortex-duckdb" section that states what to do. Signed-off-by: Nicholas Gates <nick@spiraldb.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Nicholas Gates <nick@nickgates.com>
gatesn
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7819
Generated with Claude Code.
View Claude run