Repository navigation
feat: add column projection across profiling paths - #655
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Zero-row database results bypass projection validation, and projected Python column inputs report incomplete source-memory metadata.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds consistent top-level column projection across Rust, Python, database, streaming, and Parquet profiling paths.
Changes:
- Centralizes projection validation, ordering, and quality-dimension suppression.
- Adds physical nested-aware Parquet pruning.
- Expands cross-path tests and Python API support.
File summaries
| File | Description |
|---|---|
crates/dataprof-core/src/analysis_options.rs |
Defines projection contract and validation. |
crates/dataprof/src/profiler.rs |
Exposes and routes column selection. |
crates/dataprof-runtime/src/streaming_stats.rs |
Filters streaming column statistics. |
crates/dataprof-runtime/src/report_assembler.rs |
Withholds projection-sensitive quality dimensions. |
crates/dataprof-engines/src/adaptive.rs |
Propagates projection through adaptive routing. |
crates/dataprof-engines/src/streaming/incremental.rs |
Applies projection to incremental CSV profiling. |
crates/dataprof-engines/src/streaming/async_reader.rs |
Applies projection to asynchronous streams. |
crates/dataprof-json/src/lib.rs |
Filters JSON/JSONL profiles. |
crates/dataprof-parquet/src/parser.rs |
Adds physical leaf projection and tests. |
crates/dataprof-parquet/src/async_http.rs |
Projects remote Parquet reads. |
crates/dataprof-parquet/src/arrow_profiler.rs |
Projects columnar CSV batches. |
crates/dataprof-db/src/lib.rs |
Applies projection to query results. |
crates/dataprof-db/src/query_columns.rs |
Adds ordered query-column filtering. |
crates/dataprof-python/src/config.rs |
Adds Python projection configuration. |
crates/dataprof-python/src/columns.rs |
Projects Python-native column sources. |
crates/dataprof-python/src/arrow_export.rs |
Projects DataFrame and Arrow batches. |
python/dataprof/__init__.py |
Exposes projection in Python APIs. |
python/dataprof/__init__.pyi |
Updates public Python type declarations. |
python/dataprof/_dataprof.pyi |
Updates native extension stubs. |
tests/analysis_option_parity.rs |
Adds Rust cross-format parity coverage. |
python/tests/test_analysis_option_parity.py |
Adds Python cross-path projection tests. |
python/tests/test_python_api.py |
Verifies Python signatures and fluent API. |
Review details
- Files reviewed: 22/22 changed files
- Comments generated: 5
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
One small housekeeping item: this PR appears to fully implement #638, but |
AndreaBozzo
left a comment
There was a problem hiding this comment.
Thank you so much for this contribution, @QinXi-ai, and especially for the careful, comprehensive follow-up. You addressed every review point with focused regression coverage: zero-row database projection now preserves and validates the schema, source-memory provenance remains stable, the Python positional API stays backward compatible, the output contract is documented, and the decode-audit gate is clean. I also re-ran the focused database tests and decode audit on the current merge commit; everything passes. This is a substantial cross-path improvement—great work!
* docs(python): document column projection `columns` shipped in #655 and reached the type stubs, `Profiler`, and `ProfilerConfig`, but never the Python API guide: the documented `dp.profile()` signature omitted it and no section described it. Record the parameter and the semantics that are easy to guess wrong: projection selects columns and never rows, the report keeps source order rather than the order the names were listed in, unknown and repeated names raise instead of being ignored, `columns=[]` differs from `columns=None`, and quality is assessed over the projection only, so the score answers a narrower question than the whole-dataset score. * docs(python): record projection's async surface and withheld dimensions Two gaps from review of the projection section. The entry-point list omitted `dataprof.asyncio`; all three of its entry points forward `**kwargs` through `ProfilerConfig`, so projection was documented as if it were sync-only. Quality was described as merely narrowing to the projected columns. It also withholds `completeness` and `uniqueness`, whose row-level fields would otherwise report projected measurements under full-row names. That is worth stating outright: it leaves both dimensions `None`, drops the overall score to an average over fewer dimensions — usually raising it, since `completeness` is what penalizes nulls — and yields no quality object at all when a projection is combined with `quality_dimensions` naming only those two.
What changed
AnalysisOptions, with duplicate and unknown-name validation, source-schema ordering, and an explicit empty-selection result.ProjectionMask::leaves, so unselected column chunks are not read and every leaf under a selected nested field is retained.Nonewhenever projection is active, because their row-level report fields are not independently optional.InvalidConfigurationerrors through adaptive fallback and add cross-path, nested-field, and physical byte-range regression coverage.Related issue: Closes #638
How it was verified
Follow-up review validation
The full workspace suite includes
projected_reader_never_reads_unselected_column_chunksandtop_level_projection_keeps_every_leaf_of_a_nested_column.Anything reviewers should know