Skip to content

Commit

Permalink
remove panic on schema
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite committed Jan 24, 2025
1 parent 56b1c43 commit 52aa4a4
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 42 deletions.
1 change: 0 additions & 1 deletion crates/polars-expr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,3 @@ round_series = ["polars-plan/round_series", "polars-ops/round_series"]
is_between = ["polars-plan/is_between"]
dynamic_group_by = ["polars-plan/dynamic_group_by", "polars-time", "temporal"]
propagate_nans = ["polars-plan/propagate_nans", "polars-ops/propagate_nans"]
panic_on_schema = ["polars-plan/panic_on_schema"]
32 changes: 1 addition & 31 deletions crates/polars-expr/src/expressions/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,7 @@ impl ColumnExpr {
}
}

// this path should not happen
#[cfg(feature = "panic_on_schema")]
{
if _state.ext_contexts.is_empty()
&& std::env::var("POLARS_NO_SCHEMA_CHECK").is_err()
{
panic!(
"got {} expected: {} from schema: {:?} and DataFrame: {:?}",
out.name(),
&*self.name,
_schema,
df
)
}
}
// in release we fallback to linear search
#[allow(unreachable_code)]
{
df.column(&self.name).cloned()
}
df.column(&self.name).cloned()
} else {
Ok(out.clone())
}
Expand All @@ -87,17 +68,6 @@ impl ColumnExpr {
_state: &ExecutionState,
_panic_during_test: bool,
) -> PolarsResult<Column> {
#[cfg(feature = "panic_on_schema")]
{
if _panic_during_test
&& _state.ext_contexts.is_empty()
&& std::env::var("POLARS_NO_SCHEMA_CHECK").is_err()
{
panic!("invalid schema: df {:?};\ncolumn: {}", df, &self.name)
}
}
// in release we fallback to linear search
#[allow(unreachable_code)]
df.column(&self.name).cloned()
}

Expand Down
5 changes: 0 additions & 5 deletions crates/polars-io/src/parquet/read/read_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,6 @@ fn rg_to_dfs_optionally_par_over_columns(
*previous_row_count += rg_slice.1 as IdxSize;
continue;
}
// test we don't read the parquet file if this env var is set
#[cfg(debug_assertions)]
{
assert!(std::env::var("POLARS_PANIC_IF_PARQUET_PARSED").is_err())
}

let sorting_map = create_sorting_map(md);

Expand Down
3 changes: 0 additions & 3 deletions crates/polars-lazy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,8 @@ string_encoding = ["polars-plan/string_encoding"]
bigidx = ["polars-plan/bigidx", "polars-utils/bigidx"]
polars_cloud = ["polars-plan/polars_cloud"]

panic_on_schema = ["polars-plan/panic_on_schema", "polars-expr/panic_on_schema"]

test = [
"polars-plan/debugging",
"panic_on_schema",
"rolling_window",
"rank",
"round_series",
Expand Down
2 changes: 0 additions & 2 deletions crates/polars-plan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ bigidx = ["polars-core/bigidx", "polars-utils/bigidx"]
polars_cloud = ["serde"]
ir_serde = ["serde", "polars-utils/ir_serde"]

panic_on_schema = []

[package.metadata.docs.rs]
features = [
"bitwise",
Expand Down

0 comments on commit 52aa4a4

Please sign in to comment.