Skip to content

Commit

Permalink
fix: util::get_stats_records no longer infers boolean in StatsMode::P…
Browse files Browse the repository at this point in the history
…olarsSchema

this ultimately was the root cause of the problem reported in #2369
  • Loading branch information
jqnatividad committed Dec 24, 2024
1 parent 23ec8b0 commit cebb664
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2102,8 +2102,8 @@ pub fn get_stats_records(
#[cfg(feature = "polars")]
StatsMode::PolarsSchema => {
// StatsMode::PolarsSchema
// we need data types and ranges
format!("stats\t{input}\t--infer-boolean\t--stats-jsonl\t--output\t{tempfile_path}")
// we need data types, ranges & cardinality
format!("stats\t{input}\t--cardinality\t--stats-jsonl\t--output\t{tempfile_path}")
},
StatsMode::None => unreachable!(), // we returned early on None earlier
};
Expand Down
8 changes: 5 additions & 3 deletions tests/test_joinp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ joinp_test!(joinp_inner, |wrk: Workdir, mut cmd: process::Command| {
joinp_test_cache_schema!(
joinp_inner_cache_schema,
|wrk: Workdir, mut cmd: process::Command| {
wrk.assert_success(&mut cmd);

let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd);
let expected = make_rows(
false,
Expand Down Expand Up @@ -1701,9 +1703,9 @@ fn test_joinp_cache_schema() {
.arg("--cache-schema")
.arg("1");

// error is expected as has_text is interpreted as bool, rather than a number of just a string
// recreates error reported in https://github.com/dathere/qsv/issues/2369
wrk.assert_err(&mut cmd);
// success is expected as has_text is no longer interpreted as bool
// confirms bug reported in https://github.com/dathere/qsv/issues/2369 no longer exists
wrk.assert_success(&mut cmd);

// Verify schema files were created
assert!(wrk.path("left.pschema.json").exists());
Expand Down

0 comments on commit cebb664

Please sign in to comment.