Skip to content

Commit 78cfa01

Browse files
committed
refactor(rust): Don't enable ir_serde together with serde
1 parent 4514037 commit 78cfa01

File tree

29 files changed

+94
-80
lines changed

29 files changed

+94
-80
lines changed

crates/polars-lazy/src/frame/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,7 +2516,6 @@ impl JoinBuilder {
25162516
allow_parallel: self.allow_parallel,
25172517
force_parallel: self.force_parallel,
25182518
args,
2519-
..Default::default()
25202519
}
25212520
.into(),
25222521
)
@@ -2600,7 +2599,6 @@ impl JoinBuilder {
26002599
allow_parallel: self.allow_parallel,
26012600
force_parallel: self.force_parallel,
26022601
args,
2603-
..Default::default()
26042602
};
26052603

26062604
let lp = DslPlan::Join {

crates/polars-ops/src/frame/join/args.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,10 @@ impl Debug for CrossJoinOptions {
197197
}
198198

199199
#[derive(Clone, PartialEq, Eq, Hash, IntoStaticStr, Debug)]
200-
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
201200
#[strum(serialize_all = "snake_case")]
202201
pub enum JoinTypeOptions {
203202
#[cfg(feature = "iejoin")]
204203
IEJoin(IEJoinOptions),
205-
#[cfg_attr(feature = "serde", serde(skip))]
206204
Cross(CrossJoinOptions),
207205
}
208206

crates/polars-ops/src/frame/join/iejoin/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use crate::frame::_finish_join;
2626

2727
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
2828
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
29-
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
3029
pub enum InequalityOperator {
3130
#[default]
3231
Lt,
@@ -42,7 +41,6 @@ impl InequalityOperator {
4241
}
4342
#[derive(Clone, Debug, PartialEq, Eq, Default, Hash)]
4443
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
45-
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
4644
pub struct IEJoinOptions {
4745
pub operator1: InequalityOperator,
4846
pub operator2: Option<InequalityOperator>,

crates/polars-pipe/src/pipeline/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ where
685685
))
686686
}
687687

688-
pub fn swap_join_order(options: &JoinOptions) -> bool {
688+
pub fn swap_join_order(options: &JoinOptionsIR) -> bool {
689689
matches!(options.args.how, JoinType::Left)
690690
|| match (options.rows_left, options.rows_right) {
691691
((Some(left), _), (Some(right), _)) => left > right,

crates/polars-plan/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ version_check = { workspace = true }
5454
debugging = []
5555
python = ["dep:pyo3", "polars-utils/python", "polars-ffi", "polars-core/object"]
5656
serde = [
57-
"ir_serde",
5857
"dep:serde",
5958
"polars-core/serde-lazy",
6059
"polars-time/serde",

crates/polars-plan/dsl-schema.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e014c056d5a8fa3f83eb414d0153a3359e17d326d1cb77aca36a69aaaf155c59
1+
0ead21af3cf8bf9d7a7dd51bde1d034b3cd477f0e9bd1a8043d71529116e8805

crates/polars-plan/src/dsl/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ impl Expr {
508508
/// Returns the `k` smallest rows by given column.
509509
///
510510
/// For single column, use [`Expr::bottom_k`].
511-
// #[cfg(feature = "top_k")]
512511
#[cfg(feature = "top_k")]
513512
pub fn bottom_k_by<K: Into<Expr>, E: AsRef<[IE]>, IE: Into<Expr> + Clone>(
514513
self,

crates/polars-plan/src/dsl/options/mod.rs

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,15 @@ impl Default for StrptimeOptions {
7070
}
7171

7272
#[derive(Clone, PartialEq, Eq, IntoStaticStr, Debug)]
73-
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
74-
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
73+
#[cfg_attr(feature = "ir_serde", derive(Serialize, Deserialize))]
7574
#[strum(serialize_all = "snake_case")]
7675
pub enum JoinTypeOptionsIR {
7776
#[cfg(feature = "iejoin")]
7877
IEJoin(IEJoinOptions),
79-
#[cfg_attr(
80-
all(
81-
any(feature = "serde", feature = "dsl-schema"),
82-
not(feature = "ir_serde")
83-
),
84-
serde(skip)
85-
)]
8678
// Fused cross join and filter (only in in-memory engine)
87-
Cross { predicate: ExprIR },
79+
Cross {
80+
predicate: ExprIR,
81+
},
8882
}
8983

9084
impl Hash for JoinTypeOptionsIR {
@@ -117,9 +111,8 @@ impl JoinTypeOptionsIR {
117111
}
118112

119113
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
120-
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
121-
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
122-
pub struct JoinOptions {
114+
#[cfg_attr(feature = "ir_serde", derive(Serialize, Deserialize))]
115+
pub struct JoinOptionsIR {
123116
pub allow_parallel: bool,
124117
pub force_parallel: bool,
125118
pub args: JoinArgs,
@@ -130,16 +123,45 @@ pub struct JoinOptions {
130123
pub rows_right: (Option<usize>, usize),
131124
}
132125

126+
impl From<JoinOptions> for JoinOptionsIR {
127+
fn from(opts: JoinOptions) -> Self {
128+
Self {
129+
allow_parallel: opts.allow_parallel,
130+
force_parallel: opts.force_parallel,
131+
args: opts.args,
132+
options: Default::default(),
133+
rows_left: (None, usize::MAX),
134+
rows_right: (None, usize::MAX),
135+
}
136+
}
137+
}
138+
139+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
140+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
141+
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
142+
pub struct JoinOptions {
143+
pub allow_parallel: bool,
144+
pub force_parallel: bool,
145+
pub args: JoinArgs,
146+
}
147+
133148
impl Default for JoinOptions {
134149
fn default() -> Self {
135150
JoinOptions {
136151
allow_parallel: true,
137152
force_parallel: false,
138153
// Todo!: make default
139154
args: JoinArgs::new(JoinType::Left),
140-
options: Default::default(),
141-
rows_left: (None, usize::MAX),
142-
rows_right: (None, usize::MAX),
155+
}
156+
}
157+
}
158+
159+
impl From<JoinOptionsIR> for JoinOptions {
160+
fn from(opts: JoinOptionsIR) -> Self {
161+
Self {
162+
allow_parallel: opts.allow_parallel,
163+
force_parallel: opts.force_parallel,
164+
args: opts.args,
143165
}
144166
}
145167
}

crates/polars-plan/src/dsl/options/sink.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ pub struct FileSinkType {
184184
pub enum SinkTypeIR {
185185
Memory,
186186
File(FileSinkType),
187+
#[cfg_attr(all(feature = "serde", not(feature = "ir_serde")), serde(skip))]
187188
Partition(PartitionSinkTypeIR),
188189
}
189190

@@ -443,7 +444,7 @@ pub struct SortColumn {
443444
pub nulls_last: bool,
444445
}
445446

446-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
447+
#[cfg_attr(feature = "ir_serde", derive(serde::Serialize, serde::Deserialize))]
447448
#[derive(Clone, Debug, PartialEq)]
448449
pub struct SortColumnIR {
449450
pub expr: ExprIR,
@@ -465,7 +466,7 @@ pub struct PartitionSinkType {
465466
pub finish_callback: Option<SinkFinishCallback>,
466467
}
467468

468-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
469+
#[cfg_attr(feature = "ir_serde", derive(serde::Serialize, serde::Deserialize))]
469470
#[derive(Clone, Debug, PartialEq)]
470471
pub struct PartitionSinkTypeIR {
471472
pub base_path: Arc<PathBuf>,
@@ -502,7 +503,7 @@ pub enum PartitionVariant {
502503
},
503504
}
504505

505-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
506+
#[cfg_attr(feature = "ir_serde", derive(serde::Serialize, serde::Deserialize))]
506507
#[derive(Clone, Debug, PartialEq, Eq)]
507508
pub enum PartitionVariantIR {
508509
MaxSize(IdxSize),

crates/polars-plan/src/plans/builder_ir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<'a> IRBuilder<'a> {
320320
other: Node,
321321
left_on: Vec<ExprIR>,
322322
right_on: Vec<ExprIR>,
323-
options: Arc<JoinOptions>,
323+
options: Arc<JoinOptionsIR>,
324324
) -> Self {
325325
let schema_left = self.schema();
326326
let schema_right = self.lp_arena.get(other).schema(self.lp_arena);

0 commit comments

Comments
 (0)