Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-plan/src/dsl/function_expr/mod.rs
6940 views
1
#[cfg(feature = "dtype-array")]
2
mod array;
3
mod binary;
4
#[cfg(feature = "bitwise")]
5
mod bitwise;
6
mod boolean;
7
#[cfg(feature = "business")]
8
mod business;
9
#[cfg(feature = "dtype-categorical")]
10
mod cat;
11
#[cfg(feature = "cov")]
12
mod correlation;
13
#[cfg(feature = "temporal")]
14
mod datetime;
15
mod list;
16
mod pow;
17
#[cfg(feature = "random")]
18
mod random;
19
#[cfg(feature = "range")]
20
mod range;
21
#[cfg(feature = "rolling_window")]
22
mod rolling;
23
#[cfg(feature = "rolling_window_by")]
24
mod rolling_by;
25
#[cfg(feature = "strings")]
26
mod strings;
27
#[cfg(feature = "dtype-struct")]
28
mod struct_;
29
#[cfg(feature = "trigonometry")]
30
mod trigonometry;
31
32
use std::fmt::{Display, Formatter};
33
use std::hash::{Hash, Hasher};
34
35
#[cfg(feature = "dtype-array")]
36
pub use array::ArrayFunction;
37
#[cfg(feature = "cov")]
38
pub use correlation::CorrelationMethod;
39
pub use list::ListFunction;
40
pub use polars_core::datatypes::ReshapeDimension;
41
use polars_core::prelude::*;
42
#[cfg(feature = "random")]
43
pub use random::RandomMethod;
44
#[cfg(feature = "serde")]
45
use serde::{Deserialize, Serialize};
46
47
pub use self::binary::BinaryFunction;
48
#[cfg(feature = "bitwise")]
49
pub use self::bitwise::BitwiseFunction;
50
pub use self::boolean::BooleanFunction;
51
#[cfg(feature = "business")]
52
pub use self::business::BusinessFunction;
53
#[cfg(feature = "dtype-categorical")]
54
pub use self::cat::CategoricalFunction;
55
#[cfg(feature = "temporal")]
56
pub use self::datetime::TemporalFunction;
57
pub use self::pow::PowFunction;
58
#[cfg(feature = "range")]
59
pub use self::range::RangeFunction;
60
#[cfg(feature = "rolling_window")]
61
pub use self::rolling::RollingFunction;
62
#[cfg(feature = "rolling_window_by")]
63
pub use self::rolling_by::RollingFunctionBy;
64
#[cfg(feature = "strings")]
65
pub use self::strings::StringFunction;
66
#[cfg(feature = "dtype-struct")]
67
pub use self::struct_::StructFunction;
68
#[cfg(feature = "trigonometry")]
69
pub use self::trigonometry::TrigonometricFunction;
70
use super::*;
71
72
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
73
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
74
#[derive(Clone, PartialEq, Debug)]
75
pub enum FunctionExpr {
76
// Namespaces
77
#[cfg(feature = "dtype-array")]
78
ArrayExpr(ArrayFunction),
79
BinaryExpr(BinaryFunction),
80
#[cfg(feature = "dtype-categorical")]
81
Categorical(CategoricalFunction),
82
ListExpr(ListFunction),
83
#[cfg(feature = "strings")]
84
StringExpr(StringFunction),
85
#[cfg(feature = "dtype-struct")]
86
StructExpr(StructFunction),
87
#[cfg(feature = "temporal")]
88
TemporalExpr(TemporalFunction),
89
#[cfg(feature = "bitwise")]
90
Bitwise(BitwiseFunction),
91
92
// Other expressions
93
Boolean(BooleanFunction),
94
#[cfg(feature = "business")]
95
Business(BusinessFunction),
96
#[cfg(feature = "abs")]
97
Abs,
98
Negate,
99
#[cfg(feature = "hist")]
100
Hist {
101
bin_count: Option<usize>,
102
include_category: bool,
103
include_breakpoint: bool,
104
},
105
NullCount,
106
Pow(PowFunction),
107
#[cfg(feature = "row_hash")]
108
Hash(u64, u64, u64, u64),
109
#[cfg(feature = "arg_where")]
110
ArgWhere,
111
#[cfg(feature = "index_of")]
112
IndexOf,
113
#[cfg(feature = "search_sorted")]
114
SearchSorted {
115
side: SearchSortedSide,
116
descending: bool,
117
},
118
#[cfg(feature = "range")]
119
Range(RangeFunction),
120
#[cfg(feature = "trigonometry")]
121
Trigonometry(TrigonometricFunction),
122
#[cfg(feature = "trigonometry")]
123
Atan2,
124
#[cfg(feature = "sign")]
125
Sign,
126
FillNull,
127
FillNullWithStrategy(FillNullStrategy),
128
#[cfg(feature = "rolling_window")]
129
RollingExpr {
130
function: RollingFunction,
131
options: RollingOptionsFixedWindow,
132
},
133
#[cfg(feature = "rolling_window_by")]
134
RollingExprBy {
135
function_by: RollingFunctionBy,
136
options: RollingOptionsDynamicWindow,
137
},
138
Rechunk,
139
Append {
140
upcast: bool,
141
},
142
ShiftAndFill,
143
Shift,
144
DropNans,
145
DropNulls,
146
#[cfg(feature = "mode")]
147
Mode,
148
#[cfg(feature = "moment")]
149
Skew(bool),
150
#[cfg(feature = "moment")]
151
Kurtosis(bool, bool),
152
#[cfg(feature = "dtype-array")]
153
Reshape(Vec<ReshapeDimension>),
154
#[cfg(feature = "repeat_by")]
155
RepeatBy,
156
ArgUnique,
157
ArgMin,
158
ArgMax,
159
ArgSort {
160
descending: bool,
161
nulls_last: bool,
162
},
163
Product,
164
#[cfg(feature = "rank")]
165
Rank {
166
options: RankOptions,
167
seed: Option<u64>,
168
},
169
Repeat,
170
#[cfg(feature = "round_series")]
171
Clip {
172
has_min: bool,
173
has_max: bool,
174
},
175
#[cfg(feature = "dtype-struct")]
176
AsStruct,
177
#[cfg(feature = "top_k")]
178
TopK {
179
descending: bool,
180
},
181
#[cfg(feature = "top_k")]
182
TopKBy {
183
descending: Vec<bool>,
184
},
185
#[cfg(feature = "cum_agg")]
186
CumCount {
187
reverse: bool,
188
},
189
#[cfg(feature = "cum_agg")]
190
CumSum {
191
reverse: bool,
192
},
193
#[cfg(feature = "cum_agg")]
194
CumProd {
195
reverse: bool,
196
},
197
#[cfg(feature = "cum_agg")]
198
CumMin {
199
reverse: bool,
200
},
201
#[cfg(feature = "cum_agg")]
202
CumMax {
203
reverse: bool,
204
},
205
Reverse,
206
#[cfg(feature = "dtype-struct")]
207
ValueCounts {
208
sort: bool,
209
parallel: bool,
210
name: PlSmallStr,
211
normalize: bool,
212
},
213
#[cfg(feature = "unique_counts")]
214
UniqueCounts,
215
#[cfg(feature = "approx_unique")]
216
ApproxNUnique,
217
Coalesce,
218
#[cfg(feature = "diff")]
219
Diff(NullBehavior),
220
#[cfg(feature = "pct_change")]
221
PctChange,
222
#[cfg(feature = "interpolate")]
223
Interpolate(InterpolationMethod),
224
#[cfg(feature = "interpolate_by")]
225
InterpolateBy,
226
#[cfg(feature = "log")]
227
Entropy {
228
base: f64,
229
normalize: bool,
230
},
231
#[cfg(feature = "log")]
232
Log,
233
#[cfg(feature = "log")]
234
Log1p,
235
#[cfg(feature = "log")]
236
Exp,
237
Unique(bool),
238
#[cfg(feature = "round_series")]
239
Round {
240
decimals: u32,
241
mode: RoundMode,
242
},
243
#[cfg(feature = "round_series")]
244
RoundSF {
245
digits: i32,
246
},
247
#[cfg(feature = "round_series")]
248
Floor,
249
#[cfg(feature = "round_series")]
250
Ceil,
251
UpperBound,
252
LowerBound,
253
ConcatExpr(bool),
254
#[cfg(feature = "cov")]
255
Correlation {
256
method: correlation::CorrelationMethod,
257
},
258
#[cfg(feature = "peaks")]
259
PeakMin,
260
#[cfg(feature = "peaks")]
261
PeakMax,
262
#[cfg(feature = "cutqcut")]
263
Cut {
264
breaks: Vec<f64>,
265
labels: Option<Vec<PlSmallStr>>,
266
left_closed: bool,
267
include_breaks: bool,
268
},
269
#[cfg(feature = "cutqcut")]
270
QCut {
271
probs: Vec<f64>,
272
labels: Option<Vec<PlSmallStr>>,
273
left_closed: bool,
274
allow_duplicates: bool,
275
include_breaks: bool,
276
},
277
#[cfg(feature = "rle")]
278
RLE,
279
#[cfg(feature = "rle")]
280
RLEID,
281
ToPhysical,
282
#[cfg(feature = "random")]
283
Random {
284
method: random::RandomMethod,
285
seed: Option<u64>,
286
},
287
SetSortedFlag(IsSorted),
288
#[cfg(feature = "ffi_plugin")]
289
/// Creating this node is unsafe
290
/// This will lead to calls over FFI.
291
FfiPlugin {
292
flags: FunctionOptions,
293
/// Shared library.
294
lib: PlSmallStr,
295
/// Identifier in the shared lib.
296
symbol: PlSmallStr,
297
/// Pickle serialized keyword arguments.
298
kwargs: Arc<[u8]>,
299
},
300
301
FoldHorizontal {
302
callback: PlanCallback<(Series, Series), Series>,
303
returns_scalar: bool,
304
return_dtype: Option<DataTypeExpr>,
305
},
306
ReduceHorizontal {
307
callback: PlanCallback<(Series, Series), Series>,
308
returns_scalar: bool,
309
return_dtype: Option<DataTypeExpr>,
310
},
311
#[cfg(feature = "dtype-struct")]
312
CumReduceHorizontal {
313
callback: PlanCallback<(Series, Series), Series>,
314
returns_scalar: bool,
315
return_dtype: Option<DataTypeExpr>,
316
},
317
#[cfg(feature = "dtype-struct")]
318
CumFoldHorizontal {
319
callback: PlanCallback<(Series, Series), Series>,
320
returns_scalar: bool,
321
return_dtype: Option<DataTypeExpr>,
322
include_init: bool,
323
},
324
325
MaxHorizontal,
326
MinHorizontal,
327
SumHorizontal {
328
ignore_nulls: bool,
329
},
330
MeanHorizontal {
331
ignore_nulls: bool,
332
},
333
#[cfg(feature = "ewma")]
334
EwmMean {
335
options: EWMOptions,
336
},
337
#[cfg(feature = "ewma_by")]
338
EwmMeanBy {
339
half_life: Duration,
340
},
341
#[cfg(feature = "ewma")]
342
EwmStd {
343
options: EWMOptions,
344
},
345
#[cfg(feature = "ewma")]
346
EwmVar {
347
options: EWMOptions,
348
},
349
#[cfg(feature = "replace")]
350
Replace,
351
#[cfg(feature = "replace")]
352
ReplaceStrict {
353
return_dtype: Option<DataTypeExpr>,
354
},
355
GatherEvery {
356
n: usize,
357
offset: usize,
358
},
359
#[cfg(feature = "reinterpret")]
360
Reinterpret(bool),
361
ExtendConstant,
362
363
RowEncode(RowEncodingVariant),
364
#[cfg(feature = "dtype-struct")]
365
RowDecode(Vec<(PlSmallStr, DataTypeExpr)>, RowEncodingVariant),
366
}
367
368
impl Hash for FunctionExpr {
369
fn hash<H: Hasher>(&self, state: &mut H) {
370
std::mem::discriminant(self).hash(state);
371
use FunctionExpr::*;
372
match self {
373
// Namespaces
374
#[cfg(feature = "dtype-array")]
375
ArrayExpr(f) => f.hash(state),
376
BinaryExpr(f) => f.hash(state),
377
#[cfg(feature = "dtype-categorical")]
378
Categorical(f) => f.hash(state),
379
ListExpr(f) => f.hash(state),
380
#[cfg(feature = "strings")]
381
StringExpr(f) => f.hash(state),
382
#[cfg(feature = "dtype-struct")]
383
StructExpr(f) => f.hash(state),
384
#[cfg(feature = "temporal")]
385
TemporalExpr(f) => f.hash(state),
386
#[cfg(feature = "bitwise")]
387
Bitwise(f) => f.hash(state),
388
389
// Other expressions
390
Boolean(f) => f.hash(state),
391
#[cfg(feature = "business")]
392
Business(f) => f.hash(state),
393
Pow(f) => f.hash(state),
394
#[cfg(feature = "index_of")]
395
IndexOf => {},
396
#[cfg(feature = "search_sorted")]
397
SearchSorted { side, descending } => {
398
side.hash(state);
399
descending.hash(state);
400
},
401
#[cfg(feature = "random")]
402
Random { method, .. } => method.hash(state),
403
#[cfg(feature = "cov")]
404
Correlation { method, .. } => method.hash(state),
405
#[cfg(feature = "range")]
406
Range(f) => f.hash(state),
407
#[cfg(feature = "trigonometry")]
408
Trigonometry(f) => f.hash(state),
409
#[cfg(feature = "diff")]
410
Diff(null_behavior) => null_behavior.hash(state),
411
#[cfg(feature = "interpolate")]
412
Interpolate(f) => f.hash(state),
413
#[cfg(feature = "interpolate_by")]
414
InterpolateBy => {},
415
#[cfg(feature = "ffi_plugin")]
416
FfiPlugin {
417
flags: _,
418
lib,
419
symbol,
420
kwargs,
421
} => {
422
kwargs.hash(state);
423
lib.hash(state);
424
symbol.hash(state);
425
},
426
427
FoldHorizontal {
428
callback,
429
returns_scalar,
430
return_dtype,
431
}
432
| ReduceHorizontal {
433
callback,
434
returns_scalar,
435
return_dtype,
436
} => {
437
callback.hash(state);
438
returns_scalar.hash(state);
439
return_dtype.hash(state);
440
},
441
#[cfg(feature = "dtype-struct")]
442
CumReduceHorizontal {
443
callback,
444
returns_scalar,
445
return_dtype,
446
} => {
447
callback.hash(state);
448
returns_scalar.hash(state);
449
return_dtype.hash(state);
450
},
451
#[cfg(feature = "dtype-struct")]
452
CumFoldHorizontal {
453
callback,
454
returns_scalar,
455
return_dtype,
456
include_init,
457
} => {
458
callback.hash(state);
459
returns_scalar.hash(state);
460
return_dtype.hash(state);
461
include_init.hash(state);
462
},
463
SumHorizontal { ignore_nulls } | MeanHorizontal { ignore_nulls } => {
464
ignore_nulls.hash(state)
465
},
466
MaxHorizontal | MinHorizontal | DropNans | DropNulls | Reverse | ArgUnique | ArgMin
467
| ArgMax | Product | Shift | ShiftAndFill | Rechunk => {},
468
Append { upcast } => upcast.hash(state),
469
ArgSort {
470
descending,
471
nulls_last,
472
} => {
473
descending.hash(state);
474
nulls_last.hash(state);
475
},
476
#[cfg(feature = "mode")]
477
Mode => {},
478
#[cfg(feature = "abs")]
479
Abs => {},
480
Negate => {},
481
NullCount => {},
482
#[cfg(feature = "arg_where")]
483
ArgWhere => {},
484
#[cfg(feature = "trigonometry")]
485
Atan2 => {},
486
#[cfg(feature = "dtype-struct")]
487
AsStruct => {},
488
#[cfg(feature = "sign")]
489
Sign => {},
490
#[cfg(feature = "row_hash")]
491
Hash(a, b, c, d) => (a, b, c, d).hash(state),
492
FillNull => {},
493
#[cfg(feature = "rolling_window")]
494
RollingExpr { function, options } => {
495
function.hash(state);
496
options.hash(state);
497
},
498
#[cfg(feature = "rolling_window_by")]
499
RollingExprBy {
500
function_by,
501
options,
502
} => {
503
function_by.hash(state);
504
options.hash(state);
505
},
506
#[cfg(feature = "moment")]
507
Skew(a) => a.hash(state),
508
#[cfg(feature = "moment")]
509
Kurtosis(a, b) => {
510
a.hash(state);
511
b.hash(state);
512
},
513
Repeat => {},
514
#[cfg(feature = "rank")]
515
Rank { options, seed } => {
516
options.hash(state);
517
seed.hash(state);
518
},
519
#[cfg(feature = "round_series")]
520
Clip { has_min, has_max } => {
521
has_min.hash(state);
522
has_max.hash(state);
523
},
524
#[cfg(feature = "top_k")]
525
TopK { descending } => descending.hash(state),
526
#[cfg(feature = "cum_agg")]
527
CumCount { reverse } => reverse.hash(state),
528
#[cfg(feature = "cum_agg")]
529
CumSum { reverse } => reverse.hash(state),
530
#[cfg(feature = "cum_agg")]
531
CumProd { reverse } => reverse.hash(state),
532
#[cfg(feature = "cum_agg")]
533
CumMin { reverse } => reverse.hash(state),
534
#[cfg(feature = "cum_agg")]
535
CumMax { reverse } => reverse.hash(state),
536
#[cfg(feature = "dtype-struct")]
537
ValueCounts {
538
sort,
539
parallel,
540
name,
541
normalize,
542
} => {
543
sort.hash(state);
544
parallel.hash(state);
545
name.hash(state);
546
normalize.hash(state);
547
},
548
#[cfg(feature = "unique_counts")]
549
UniqueCounts => {},
550
#[cfg(feature = "approx_unique")]
551
ApproxNUnique => {},
552
Coalesce => {},
553
#[cfg(feature = "pct_change")]
554
PctChange => {},
555
#[cfg(feature = "log")]
556
Entropy { base, normalize } => {
557
base.to_bits().hash(state);
558
normalize.hash(state);
559
},
560
#[cfg(feature = "log")]
561
Log => {},
562
#[cfg(feature = "log")]
563
Log1p => {},
564
#[cfg(feature = "log")]
565
Exp => {},
566
Unique(a) => a.hash(state),
567
#[cfg(feature = "round_series")]
568
Round { decimals, mode } => {
569
decimals.hash(state);
570
mode.hash(state);
571
},
572
#[cfg(feature = "round_series")]
573
FunctionExpr::RoundSF { digits } => digits.hash(state),
574
#[cfg(feature = "round_series")]
575
FunctionExpr::Floor => {},
576
#[cfg(feature = "round_series")]
577
Ceil => {},
578
UpperBound => {},
579
LowerBound => {},
580
ConcatExpr(a) => a.hash(state),
581
#[cfg(feature = "peaks")]
582
PeakMin => {},
583
#[cfg(feature = "peaks")]
584
PeakMax => {},
585
#[cfg(feature = "cutqcut")]
586
Cut {
587
breaks,
588
labels,
589
left_closed,
590
include_breaks,
591
} => {
592
let slice = bytemuck::cast_slice::<_, u64>(breaks);
593
slice.hash(state);
594
labels.hash(state);
595
left_closed.hash(state);
596
include_breaks.hash(state);
597
},
598
#[cfg(feature = "dtype-array")]
599
Reshape(dims) => dims.hash(state),
600
#[cfg(feature = "repeat_by")]
601
RepeatBy => {},
602
#[cfg(feature = "cutqcut")]
603
QCut {
604
probs,
605
labels,
606
left_closed,
607
allow_duplicates,
608
include_breaks,
609
} => {
610
let slice = bytemuck::cast_slice::<_, u64>(probs);
611
slice.hash(state);
612
labels.hash(state);
613
left_closed.hash(state);
614
allow_duplicates.hash(state);
615
include_breaks.hash(state);
616
},
617
#[cfg(feature = "rle")]
618
RLE => {},
619
#[cfg(feature = "rle")]
620
RLEID => {},
621
ToPhysical => {},
622
SetSortedFlag(is_sorted) => is_sorted.hash(state),
623
#[cfg(feature = "ewma")]
624
EwmMean { options } => options.hash(state),
625
#[cfg(feature = "ewma_by")]
626
EwmMeanBy { half_life } => (half_life).hash(state),
627
#[cfg(feature = "ewma")]
628
EwmStd { options } => options.hash(state),
629
#[cfg(feature = "ewma")]
630
EwmVar { options } => options.hash(state),
631
#[cfg(feature = "hist")]
632
Hist {
633
bin_count,
634
include_category,
635
include_breakpoint,
636
} => {
637
bin_count.hash(state);
638
include_category.hash(state);
639
include_breakpoint.hash(state);
640
},
641
#[cfg(feature = "replace")]
642
Replace => {},
643
#[cfg(feature = "replace")]
644
ReplaceStrict { return_dtype } => return_dtype.hash(state),
645
FillNullWithStrategy(strategy) => strategy.hash(state),
646
GatherEvery { n, offset } => (n, offset).hash(state),
647
#[cfg(feature = "reinterpret")]
648
Reinterpret(signed) => signed.hash(state),
649
ExtendConstant => {},
650
#[cfg(feature = "top_k")]
651
TopKBy { descending } => descending.hash(state),
652
653
RowEncode(variants) => variants.hash(state),
654
#[cfg(feature = "dtype-struct")]
655
RowDecode(fs, variants) => {
656
fs.hash(state);
657
variants.hash(state);
658
},
659
}
660
}
661
}
662
663
impl Display for FunctionExpr {
664
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
665
use FunctionExpr::*;
666
let s = match self {
667
// Namespaces
668
#[cfg(feature = "dtype-array")]
669
ArrayExpr(func) => return write!(f, "{func}"),
670
BinaryExpr(func) => return write!(f, "{func}"),
671
#[cfg(feature = "dtype-categorical")]
672
Categorical(func) => return write!(f, "{func}"),
673
ListExpr(func) => return write!(f, "{func}"),
674
#[cfg(feature = "strings")]
675
StringExpr(func) => return write!(f, "{func}"),
676
#[cfg(feature = "dtype-struct")]
677
StructExpr(func) => return write!(f, "{func}"),
678
#[cfg(feature = "temporal")]
679
TemporalExpr(func) => return write!(f, "{func}"),
680
#[cfg(feature = "bitwise")]
681
Bitwise(func) => return write!(f, "bitwise_{func}"),
682
683
// Other expressions
684
Boolean(func) => return write!(f, "{func}"),
685
#[cfg(feature = "business")]
686
Business(func) => return write!(f, "{func}"),
687
#[cfg(feature = "abs")]
688
Abs => "abs",
689
Negate => "negate",
690
NullCount => "null_count",
691
Pow(func) => return write!(f, "{func}"),
692
#[cfg(feature = "row_hash")]
693
Hash(_, _, _, _) => "hash",
694
#[cfg(feature = "arg_where")]
695
ArgWhere => "arg_where",
696
#[cfg(feature = "index_of")]
697
IndexOf => "index_of",
698
#[cfg(feature = "search_sorted")]
699
SearchSorted { .. } => "search_sorted",
700
#[cfg(feature = "range")]
701
Range(func) => return write!(f, "{func}"),
702
#[cfg(feature = "trigonometry")]
703
Trigonometry(func) => return write!(f, "{func}"),
704
#[cfg(feature = "trigonometry")]
705
Atan2 => return write!(f, "arctan2"),
706
#[cfg(feature = "sign")]
707
Sign => "sign",
708
FillNull => "fill_null",
709
#[cfg(feature = "rolling_window")]
710
RollingExpr { function, .. } => return write!(f, "{function}"),
711
#[cfg(feature = "rolling_window_by")]
712
RollingExprBy { function_by, .. } => return write!(f, "{function_by}"),
713
Rechunk => "rechunk",
714
Append { .. } => "upcast",
715
ShiftAndFill => "shift_and_fill",
716
DropNans => "drop_nans",
717
DropNulls => "drop_nulls",
718
#[cfg(feature = "mode")]
719
Mode => "mode",
720
#[cfg(feature = "moment")]
721
Skew(_) => "skew",
722
#[cfg(feature = "moment")]
723
Kurtosis(..) => "kurtosis",
724
ArgUnique => "arg_unique",
725
ArgMin => "arg_min",
726
ArgMax => "arg_max",
727
ArgSort { .. } => "arg_sort",
728
Product => "product",
729
Repeat => "repeat",
730
#[cfg(feature = "rank")]
731
Rank { .. } => "rank",
732
#[cfg(feature = "round_series")]
733
Clip { has_min, has_max } => match (has_min, has_max) {
734
(true, true) => "clip",
735
(false, true) => "clip_max",
736
(true, false) => "clip_min",
737
_ => unreachable!(),
738
},
739
#[cfg(feature = "dtype-struct")]
740
AsStruct => "as_struct",
741
#[cfg(feature = "top_k")]
742
TopK { descending } => {
743
if *descending {
744
"bottom_k"
745
} else {
746
"top_k"
747
}
748
},
749
#[cfg(feature = "top_k")]
750
TopKBy { .. } => "top_k_by",
751
Shift => "shift",
752
#[cfg(feature = "cum_agg")]
753
CumCount { .. } => "cum_count",
754
#[cfg(feature = "cum_agg")]
755
CumSum { .. } => "cum_sum",
756
#[cfg(feature = "cum_agg")]
757
CumProd { .. } => "cum_prod",
758
#[cfg(feature = "cum_agg")]
759
CumMin { .. } => "cum_min",
760
#[cfg(feature = "cum_agg")]
761
CumMax { .. } => "cum_max",
762
#[cfg(feature = "dtype-struct")]
763
ValueCounts { .. } => "value_counts",
764
#[cfg(feature = "unique_counts")]
765
UniqueCounts => "unique_counts",
766
Reverse => "reverse",
767
#[cfg(feature = "approx_unique")]
768
ApproxNUnique => "approx_n_unique",
769
Coalesce => "coalesce",
770
#[cfg(feature = "diff")]
771
Diff(_) => "diff",
772
#[cfg(feature = "pct_change")]
773
PctChange => "pct_change",
774
#[cfg(feature = "interpolate")]
775
Interpolate(_) => "interpolate",
776
#[cfg(feature = "interpolate_by")]
777
InterpolateBy => "interpolate_by",
778
#[cfg(feature = "log")]
779
Entropy { .. } => "entropy",
780
#[cfg(feature = "log")]
781
Log => "log",
782
#[cfg(feature = "log")]
783
Log1p => "log1p",
784
#[cfg(feature = "log")]
785
Exp => "exp",
786
Unique(stable) => {
787
if *stable {
788
"unique_stable"
789
} else {
790
"unique"
791
}
792
},
793
#[cfg(feature = "round_series")]
794
Round { .. } => "round",
795
#[cfg(feature = "round_series")]
796
RoundSF { .. } => "round_sig_figs",
797
#[cfg(feature = "round_series")]
798
Floor => "floor",
799
#[cfg(feature = "round_series")]
800
Ceil => "ceil",
801
UpperBound => "upper_bound",
802
LowerBound => "lower_bound",
803
ConcatExpr(_) => "concat_expr",
804
#[cfg(feature = "cov")]
805
Correlation { method, .. } => return Display::fmt(method, f),
806
#[cfg(feature = "peaks")]
807
PeakMin => "peak_min",
808
#[cfg(feature = "peaks")]
809
PeakMax => "peak_max",
810
#[cfg(feature = "cutqcut")]
811
Cut { .. } => "cut",
812
#[cfg(feature = "cutqcut")]
813
QCut { .. } => "qcut",
814
#[cfg(feature = "dtype-array")]
815
Reshape(_) => "reshape",
816
#[cfg(feature = "repeat_by")]
817
RepeatBy => "repeat_by",
818
#[cfg(feature = "rle")]
819
RLE => "rle",
820
#[cfg(feature = "rle")]
821
RLEID => "rle_id",
822
ToPhysical => "to_physical",
823
#[cfg(feature = "random")]
824
Random { method, .. } => method.into(),
825
SetSortedFlag(_) => "set_sorted",
826
#[cfg(feature = "ffi_plugin")]
827
FfiPlugin { lib, symbol, .. } => return write!(f, "{lib}:{symbol}"),
828
FoldHorizontal { .. } => "fold",
829
ReduceHorizontal { .. } => "reduce",
830
#[cfg(feature = "dtype-struct")]
831
CumReduceHorizontal { .. } => "cum_reduce",
832
#[cfg(feature = "dtype-struct")]
833
CumFoldHorizontal { .. } => "cum_fold",
834
MaxHorizontal => "max_horizontal",
835
MinHorizontal => "min_horizontal",
836
SumHorizontal { .. } => "sum_horizontal",
837
MeanHorizontal { .. } => "mean_horizontal",
838
#[cfg(feature = "ewma")]
839
EwmMean { .. } => "ewm_mean",
840
#[cfg(feature = "ewma_by")]
841
EwmMeanBy { .. } => "ewm_mean_by",
842
#[cfg(feature = "ewma")]
843
EwmStd { .. } => "ewm_std",
844
#[cfg(feature = "ewma")]
845
EwmVar { .. } => "ewm_var",
846
#[cfg(feature = "hist")]
847
Hist { .. } => "hist",
848
#[cfg(feature = "replace")]
849
Replace => "replace",
850
#[cfg(feature = "replace")]
851
ReplaceStrict { .. } => "replace_strict",
852
FillNullWithStrategy(_) => "fill_null_with_strategy",
853
GatherEvery { .. } => "gather_every",
854
#[cfg(feature = "reinterpret")]
855
Reinterpret(_) => "reinterpret",
856
ExtendConstant => "extend_constant",
857
858
RowEncode(..) => "row_encode",
859
#[cfg(feature = "dtype-struct")]
860
RowDecode(..) => "row_decode",
861
};
862
write!(f, "{s}")
863
}
864
}
865
866
#[cfg(any(feature = "array_to_struct", feature = "list_to_struct"))]
867
pub type DslNameGenerator = PlanCallback<usize, String>;
868
869