datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

Use the shared aggr_test_schema in CSV scan tests instead of a local copy

Open andygrove opened this issue 1 month ago • 4 comments

Is your feature request related to a problem or challenge?

The test module in core/src/datasource/physical_plan/csv.rs defines a private aggr_test_schema() that is a verbatim copy of the public datafusion::test_util::aggr_test_schema(). If the shared schema changes (for example new columns or metadata on aggregate_test_100.csv), the CSV tests keep using the stale copy.

The same module also repeats about 35 lines of scan setup in every rstest case (session context, partitioned_file_groups, CsvOptions, TableSchema, CsvSource, FileScanConfigBuilder), differing only in projection, limit and the expected snapshot (L130-L442). json.rs (L213-L372) does the same with prepare_store and JsonSource.

Describe the solution you'd like

  1. Delete the local aggr_test_schema in the csv.rs tests and import crate::test_util::aggr_test_schema. Keep aggr_test_schema_with_missing_col as a derivation of it.
  2. Optionally add a test helper such as csv_scan_config(file_compression_type, file_schema, |builder| ...) -> FileScanConfig that does the shared setup, so each rstest case only applies its projection or limit and asserts. Do the same for json.rs.

Describe alternatives you've considered

Do step 1 only.

Additional context

Step 1 is a small, self-contained change and a good first issue. Line references are pinned to commit 0d79252f61bd.

andygrove avatar Oct 14 '26 14:10 andygrove

Hi @andygrove, I'd like to work on #26306. I'll start by replacing the duplicated schema with the shared test utility and verifying that the existing CSV tests pass. Would you prefer keeping the optional scan-setup refactoring separate?

med9110 avatar Oct 14 '26 15:10 med9110

take

mohitgurav20 avatar Oct 14 '26 19:10 mohitgurav20

4. take

You can't take all open issues !!!

Reza98Sh avatar Oct 17 '26 06:10 Reza98Sh

Hi @andygrove, I'm interested in contributing to this issue as my first DataFusion contribution. I noticed multiple contributors have expressed interest, so I wanted to check whether this task is still available.

I'm happy to work on another good first issue if someone is already handling it. Thanks!

krishnagp97 avatar Oct 19 '26 18:10 krishnagp97