Skip to content

CSV Export#73

Open
pedroripper wants to merge 15 commits intomasterfrom
pr/csv-export-2
Open

CSV Export#73
pedroripper wants to merge 15 commits intomasterfrom
pr/csv-export-2

Conversation

@pedroripper
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 88.71795% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.26%. Comparing base (066ba18) to head (4d01fbd).

Files with missing lines Patch % Lines
src/enum_map.cpp 39.53% 26 Missing ⚠️
tests/test_database_csv.cpp 94.40% 0 Missing and 14 partials ⚠️
src/database_describe.cpp 90.62% 3 Missing ⚠️
src/csv.cpp 98.27% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   86.02%   86.26%   +0.23%     
==========================================
  Files          92       97       +5     
  Lines       10291    10678     +387     
  Branches      537      585      +48     
==========================================
+ Hits         8853     9211     +358     
- Misses       1413     1428      +15     
- Partials       25       39      +14     
Flag Coverage Δ
cpp 89.27% <88.71%> (+0.15%) ⬆️
dart 76.99% <ø> (ø)
julia 70.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/quiver/database.h 100.00% <ø> (ø)
include/quiver/enum_map.h 100.00% <100.00%> (ø)
include/quiver/schema.h 100.00% <ø> (ø)
src/value.cpp 100.00% <100.00%> (ø)
src/csv.cpp 98.27% <98.27%> (ø)
src/database_describe.cpp 31.18% <90.62%> (+31.18%) ⬆️
tests/test_database_csv.cpp 94.40% <94.40%> (ø)
src/enum_map.cpp 39.53% <39.53%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CSV export support to the Quiver database layer, including foreign-key label resolution, date/time formatting, and enum-to-label mapping, along with a comprehensive new test suite and a new third-party CSV dependency.

Changes:

  • Implement Database::export_to_csv() and CSV writer utility (write_csv) using rapidcsv.
  • Add EnumMap and Value streaming support to enable enum label export and generic value-to-string conversion.
  • Add extensive CSV export tests and wire them into the test build.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/test_database_csv.cpp New tests covering CSV export scenarios (basic, empty, FK resolution, quoting, datetime formatting, enums, nulls).
tests/CMakeLists.txt Adds the new CSV test file to the test target.
src/database.cpp Implements Database::export_to_csv() and updates CSV import stub logging/validation.
src/csv.cpp Adds CSV writing implementation (FK/enum resolution, datetime formatting, null handling).
include/quiver/csv.h Introduces CSV export API/types (DateFormatMap, FkLabelMap, write_csv).
include/quiver/enum_map.h / src/enum_map.cpp Adds enum mapping type used by CSV export.
include/quiver/value.h / src/value.cpp Adds operator<< for Value to support stringification.
include/quiver/schema.h Adds TableDefinition::column_names() helper.
include/quiver/database.h Extends export_to_csv signature to accept date format and enum map parameters.
src/CMakeLists.txt Adds new source files and links rapidcsv.
cmake/Dependencies.cmake Fetches rapidcsv via FetchContent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +49 to +55
const std::vector<std::string> column_names() const {
std::vector<std::string> names;
for (const auto& [col_name, col_def] : columns) {
names.push_back(col_name);
}
return names;
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column_names() returns const std::vector<std::string> by value. Returning a const value is atypical and can inhibit moves/assignments for callers. Prefer returning a non-const std::vector<std::string> by value (or provide an output iterator/view if you want to avoid allocations).

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +13
#include "quiver/value.h"

namespace quiver {

std::ostream& operator<<(std::ostream& os, const Value& val) {
std::visit(
[&os](const auto& v) {
using T = std::decay_t<decltype(v)>;
if constexpr (!std::is_same_v<T, std::nullptr_t>) {
os << v;
}
},
val);
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value.cpp uses std::decay_t and std::is_same_v but does not include <type_traits>. This relies on transitive includes from other headers, which is not guaranteed across standard library implementations. Add the missing include to make this translation unit self-contained.

Copilot uses AI. Check for mistakes.
@pedroripper pedroripper marked this pull request as ready for review February 10, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant