Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
numeric_series.rs

1use conjure_object::serde::{ser, de};
2use conjure_object::serde::ser::SerializeMap as SerializeMap_;
3use conjure_object::private::{UnionField_, UnionTypeField_};
4use std::fmt;
5#[derive(Debug, Clone, conjure_object::private::DeriveWith)]
6#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum NumericSeries {
8    Abs(super::Abs),
9    Negate(super::Negate),
10    Cos(super::Cos),
11    Sin(super::Sin),
12    Tan(super::Tan),
13    Acos(super::Acos),
14    Asin(super::Asin),
15    Ln(super::Ln),
16    Log10(super::Log10),
17    Sqrt(super::Sqrt),
18    Add(super::Add),
19    Subtract(super::Subtract),
20    Multiply(super::Multiply),
21    Divide(super::Divide),
22    FloorDivide(super::FloorDivide),
23    Power(super::Power),
24    Modulo(super::Modulo),
25    Atan2(super::Atan2),
26    Max(super::MaxSeries),
27    Mean(super::MeanSeries),
28    Min(super::MinSeries),
29    Sum(super::SumSeries),
30    Union(super::NumericUnionSeries),
31    Product(super::ProductSeries),
32    Constant(Box<super::ConstantNumericSeries>),
33    SelectNewestPoints(super::SelectNewestPointsSeries),
34    SelectNumeric(super::SelectSeries),
35    SelectNumericProperty(super::SelectProperty),
36    SelectOldestPoints(super::SelectOldestPointsSeries),
37    BitAnd(super::BitAnd),
38    BitOr(super::BitOr),
39    BitXor(super::BitXor),
40    BitShiftRight(super::BitShiftRight),
41    BitShiftLeft(super::BitShiftLeft),
42    BitTest(super::BitTest),
43    IfElse(super::NumericIfElseSeries),
44    NumericAggregation(super::NumericAggregation),
45    CountDuplicate(super::EnumCountDuplicateSeries),
46    CumulativeSum(super::CumulativeSumSeries),
47    Derivative(super::DerivativeSeries),
48    Integral(super::IntegralSeries),
49    ZScore(super::ZscoreSeries),
50    Raw(super::Reference),
51    Derived(Box<super::DerivedSeries>),
52    Resample(super::NumericResampleSeries),
53    ResampleV2(super::NumericResampleSeriesV2),
54    NthPointDownsample(super::NumericNthPointDownsampleSeries),
55    LargestTriangleThreeBuckets(super::NumericLargestTriangleThreeBucketsSeries),
56    SignalFilter(super::SignalFilterSeries),
57    TimeDifference(super::TimeDifferenceSeries),
58    AbsoluteTimestamp(super::AbsoluteTimestampSeries),
59    TimeRangeFilter(super::NumericTimeRangeFilterSeries),
60    TimeShift(super::NumericTimeShiftSeries),
61    TimeShiftV2(super::NumericTimeShiftSeriesV2),
62    UnitConversion(super::UnitConversionSeries),
63    UnitOverride(super::UnitOverrideSeries),
64    ValueDifference(super::ValueDifferenceSeries),
65    FilterTransformation(super::NumericFilterTransformationSeries),
66    FilterWhere(super::NumericFilterWhereSeries),
67    ThresholdFilter(super::NumericThresholdFilterSeries),
68    ApproximateFilter(super::NumericApproximateFilterSeries),
69    DropNan(super::NumericNanFilter),
70    Select1dArrayIndex(super::SelectIndexFrom1dNumericArraySeries),
71    AggregateUnderRanges(super::AggregateUnderRangesSeries),
72    RangeDuration(super::RangeDurationSeries),
73    GroupWithinRangesV2(super::GroupWithinRangesSeriesV2),
74    FilterByExpression(super::FilterByExpressionSeries),
75    ScalarUdf(super::ScalarUdfSeries),
76    EnumToNumeric(super::EnumToNumericSeries),
77    Contains(super::ContainsSeries),
78    Refprop(super::RefpropSeries),
79    RefpropV2(super::RefpropSeriesV2),
80    ExtractFromStruct(super::ExtractNumericFromStructSeries),
81    TagByIntervals(super::TagByIntervalsSeries),
82    FilterByTag(super::NumericTagFilterSeries),
83    SelectTags(super::NumericSelectTagsSeries),
84    ToStartOfInterval(super::NumericToStartOfIntervalSeries),
85    PhaseUnwrap(super::PhaseUnwrapSeries),
86    #[deprecated(
87        note = "AggregateNumericSeries is deprecated. Use `numericAggregation` with `aggregation.GroupByAggregationBuilder` instead.\n"
88    )]
89    Aggregate(super::AggregateNumericSeries),
90    #[deprecated(
91        note = "RollingOperationSeries is deprecated. Use `numericAggregation` with `aggregation.RollingTimeAggregationBuilder` instead.\n"
92    )]
93    RollingOperation(super::RollingOperationSeries),
94    #[deprecated(
95        note = "BitOperationSeries is deprecated in favor of individual nodes for each operation."
96    )]
97    BitOperation(super::BitOperationSeries),
98    #[deprecated(note = "Deprecated in favor of the SelectSeries node")]
99    Channel(Box<super::ChannelSeries>),
100    #[deprecated(note = "OffsetSeries is deprecated in favor of add with a constant.")]
101    Offset(super::OffsetSeries),
102    #[deprecated(
103        note = "ScaleSeries is deprecated in favor of multiply with a constant."
104    )]
105    Scale(super::ScaleSeries),
106    #[deprecated(
107        note = "ArithmeticSeries is deprecated in favor of individual nodes for each operation."
108    )]
109    Arithmetic(super::ArithmeticSeries),
110    #[deprecated(
111        note = "UnaryArithmeticSeries is deprecated in favor of individual nodes for each operation."
112    )]
113    UnaryArithmetic(super::UnaryArithmeticSeries),
114    #[deprecated(
115        note = "BinaryArithmeticSeries is deprecated in favor of individual nodes for each operation."
116    )]
117    BinaryArithmetic(super::BinaryArithmeticSeries),
118    /// An unknown variant.
119    Unknown(Unknown),
120}
121impl ser::Serialize for NumericSeries {
122    fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
123    where
124        S: ser::Serializer,
125    {
126        let mut map = s.serialize_map(Some(2))?;
127        match self {
128            NumericSeries::Abs(value) => {
129                map.serialize_entry(&"type", &"abs")?;
130                map.serialize_entry(&"abs", value)?;
131            }
132            NumericSeries::Negate(value) => {
133                map.serialize_entry(&"type", &"negate")?;
134                map.serialize_entry(&"negate", value)?;
135            }
136            NumericSeries::Cos(value) => {
137                map.serialize_entry(&"type", &"cos")?;
138                map.serialize_entry(&"cos", value)?;
139            }
140            NumericSeries::Sin(value) => {
141                map.serialize_entry(&"type", &"sin")?;
142                map.serialize_entry(&"sin", value)?;
143            }
144            NumericSeries::Tan(value) => {
145                map.serialize_entry(&"type", &"tan")?;
146                map.serialize_entry(&"tan", value)?;
147            }
148            NumericSeries::Acos(value) => {
149                map.serialize_entry(&"type", &"acos")?;
150                map.serialize_entry(&"acos", value)?;
151            }
152            NumericSeries::Asin(value) => {
153                map.serialize_entry(&"type", &"asin")?;
154                map.serialize_entry(&"asin", value)?;
155            }
156            NumericSeries::Ln(value) => {
157                map.serialize_entry(&"type", &"ln")?;
158                map.serialize_entry(&"ln", value)?;
159            }
160            NumericSeries::Log10(value) => {
161                map.serialize_entry(&"type", &"log10")?;
162                map.serialize_entry(&"log10", value)?;
163            }
164            NumericSeries::Sqrt(value) => {
165                map.serialize_entry(&"type", &"sqrt")?;
166                map.serialize_entry(&"sqrt", value)?;
167            }
168            NumericSeries::Add(value) => {
169                map.serialize_entry(&"type", &"add")?;
170                map.serialize_entry(&"add", value)?;
171            }
172            NumericSeries::Subtract(value) => {
173                map.serialize_entry(&"type", &"subtract")?;
174                map.serialize_entry(&"subtract", value)?;
175            }
176            NumericSeries::Multiply(value) => {
177                map.serialize_entry(&"type", &"multiply")?;
178                map.serialize_entry(&"multiply", value)?;
179            }
180            NumericSeries::Divide(value) => {
181                map.serialize_entry(&"type", &"divide")?;
182                map.serialize_entry(&"divide", value)?;
183            }
184            NumericSeries::FloorDivide(value) => {
185                map.serialize_entry(&"type", &"floorDivide")?;
186                map.serialize_entry(&"floorDivide", value)?;
187            }
188            NumericSeries::Power(value) => {
189                map.serialize_entry(&"type", &"power")?;
190                map.serialize_entry(&"power", value)?;
191            }
192            NumericSeries::Modulo(value) => {
193                map.serialize_entry(&"type", &"modulo")?;
194                map.serialize_entry(&"modulo", value)?;
195            }
196            NumericSeries::Atan2(value) => {
197                map.serialize_entry(&"type", &"atan2")?;
198                map.serialize_entry(&"atan2", value)?;
199            }
200            NumericSeries::Max(value) => {
201                map.serialize_entry(&"type", &"max")?;
202                map.serialize_entry(&"max", value)?;
203            }
204            NumericSeries::Mean(value) => {
205                map.serialize_entry(&"type", &"mean")?;
206                map.serialize_entry(&"mean", value)?;
207            }
208            NumericSeries::Min(value) => {
209                map.serialize_entry(&"type", &"min")?;
210                map.serialize_entry(&"min", value)?;
211            }
212            NumericSeries::Sum(value) => {
213                map.serialize_entry(&"type", &"sum")?;
214                map.serialize_entry(&"sum", value)?;
215            }
216            NumericSeries::Union(value) => {
217                map.serialize_entry(&"type", &"union")?;
218                map.serialize_entry(&"union", value)?;
219            }
220            NumericSeries::Product(value) => {
221                map.serialize_entry(&"type", &"product")?;
222                map.serialize_entry(&"product", value)?;
223            }
224            NumericSeries::Constant(value) => {
225                map.serialize_entry(&"type", &"constant")?;
226                map.serialize_entry(&"constant", value)?;
227            }
228            NumericSeries::SelectNewestPoints(value) => {
229                map.serialize_entry(&"type", &"selectNewestPoints")?;
230                map.serialize_entry(&"selectNewestPoints", value)?;
231            }
232            NumericSeries::SelectNumeric(value) => {
233                map.serialize_entry(&"type", &"selectNumeric")?;
234                map.serialize_entry(&"selectNumeric", value)?;
235            }
236            NumericSeries::SelectNumericProperty(value) => {
237                map.serialize_entry(&"type", &"selectNumericProperty")?;
238                map.serialize_entry(&"selectNumericProperty", value)?;
239            }
240            NumericSeries::SelectOldestPoints(value) => {
241                map.serialize_entry(&"type", &"selectOldestPoints")?;
242                map.serialize_entry(&"selectOldestPoints", value)?;
243            }
244            NumericSeries::BitAnd(value) => {
245                map.serialize_entry(&"type", &"bitAnd")?;
246                map.serialize_entry(&"bitAnd", value)?;
247            }
248            NumericSeries::BitOr(value) => {
249                map.serialize_entry(&"type", &"bitOr")?;
250                map.serialize_entry(&"bitOr", value)?;
251            }
252            NumericSeries::BitXor(value) => {
253                map.serialize_entry(&"type", &"bitXor")?;
254                map.serialize_entry(&"bitXor", value)?;
255            }
256            NumericSeries::BitShiftRight(value) => {
257                map.serialize_entry(&"type", &"bitShiftRight")?;
258                map.serialize_entry(&"bitShiftRight", value)?;
259            }
260            NumericSeries::BitShiftLeft(value) => {
261                map.serialize_entry(&"type", &"bitShiftLeft")?;
262                map.serialize_entry(&"bitShiftLeft", value)?;
263            }
264            NumericSeries::BitTest(value) => {
265                map.serialize_entry(&"type", &"bitTest")?;
266                map.serialize_entry(&"bitTest", value)?;
267            }
268            NumericSeries::IfElse(value) => {
269                map.serialize_entry(&"type", &"ifElse")?;
270                map.serialize_entry(&"ifElse", value)?;
271            }
272            NumericSeries::NumericAggregation(value) => {
273                map.serialize_entry(&"type", &"numericAggregation")?;
274                map.serialize_entry(&"numericAggregation", value)?;
275            }
276            NumericSeries::CountDuplicate(value) => {
277                map.serialize_entry(&"type", &"countDuplicate")?;
278                map.serialize_entry(&"countDuplicate", value)?;
279            }
280            NumericSeries::CumulativeSum(value) => {
281                map.serialize_entry(&"type", &"cumulativeSum")?;
282                map.serialize_entry(&"cumulativeSum", value)?;
283            }
284            NumericSeries::Derivative(value) => {
285                map.serialize_entry(&"type", &"derivative")?;
286                map.serialize_entry(&"derivative", value)?;
287            }
288            NumericSeries::Integral(value) => {
289                map.serialize_entry(&"type", &"integral")?;
290                map.serialize_entry(&"integral", value)?;
291            }
292            NumericSeries::ZScore(value) => {
293                map.serialize_entry(&"type", &"zScore")?;
294                map.serialize_entry(&"zScore", value)?;
295            }
296            NumericSeries::Raw(value) => {
297                map.serialize_entry(&"type", &"raw")?;
298                map.serialize_entry(&"raw", value)?;
299            }
300            NumericSeries::Derived(value) => {
301                map.serialize_entry(&"type", &"derived")?;
302                map.serialize_entry(&"derived", value)?;
303            }
304            NumericSeries::Resample(value) => {
305                map.serialize_entry(&"type", &"resample")?;
306                map.serialize_entry(&"resample", value)?;
307            }
308            NumericSeries::ResampleV2(value) => {
309                map.serialize_entry(&"type", &"resampleV2")?;
310                map.serialize_entry(&"resampleV2", value)?;
311            }
312            NumericSeries::NthPointDownsample(value) => {
313                map.serialize_entry(&"type", &"nthPointDownsample")?;
314                map.serialize_entry(&"nthPointDownsample", value)?;
315            }
316            NumericSeries::LargestTriangleThreeBuckets(value) => {
317                map.serialize_entry(&"type", &"largestTriangleThreeBuckets")?;
318                map.serialize_entry(&"largestTriangleThreeBuckets", value)?;
319            }
320            NumericSeries::SignalFilter(value) => {
321                map.serialize_entry(&"type", &"signalFilter")?;
322                map.serialize_entry(&"signalFilter", value)?;
323            }
324            NumericSeries::TimeDifference(value) => {
325                map.serialize_entry(&"type", &"timeDifference")?;
326                map.serialize_entry(&"timeDifference", value)?;
327            }
328            NumericSeries::AbsoluteTimestamp(value) => {
329                map.serialize_entry(&"type", &"absoluteTimestamp")?;
330                map.serialize_entry(&"absoluteTimestamp", value)?;
331            }
332            NumericSeries::TimeRangeFilter(value) => {
333                map.serialize_entry(&"type", &"timeRangeFilter")?;
334                map.serialize_entry(&"timeRangeFilter", value)?;
335            }
336            NumericSeries::TimeShift(value) => {
337                map.serialize_entry(&"type", &"timeShift")?;
338                map.serialize_entry(&"timeShift", value)?;
339            }
340            NumericSeries::TimeShiftV2(value) => {
341                map.serialize_entry(&"type", &"timeShiftV2")?;
342                map.serialize_entry(&"timeShiftV2", value)?;
343            }
344            NumericSeries::UnitConversion(value) => {
345                map.serialize_entry(&"type", &"unitConversion")?;
346                map.serialize_entry(&"unitConversion", value)?;
347            }
348            NumericSeries::UnitOverride(value) => {
349                map.serialize_entry(&"type", &"unitOverride")?;
350                map.serialize_entry(&"unitOverride", value)?;
351            }
352            NumericSeries::ValueDifference(value) => {
353                map.serialize_entry(&"type", &"valueDifference")?;
354                map.serialize_entry(&"valueDifference", value)?;
355            }
356            NumericSeries::FilterTransformation(value) => {
357                map.serialize_entry(&"type", &"filterTransformation")?;
358                map.serialize_entry(&"filterTransformation", value)?;
359            }
360            NumericSeries::FilterWhere(value) => {
361                map.serialize_entry(&"type", &"filterWhere")?;
362                map.serialize_entry(&"filterWhere", value)?;
363            }
364            NumericSeries::ThresholdFilter(value) => {
365                map.serialize_entry(&"type", &"thresholdFilter")?;
366                map.serialize_entry(&"thresholdFilter", value)?;
367            }
368            NumericSeries::ApproximateFilter(value) => {
369                map.serialize_entry(&"type", &"approximateFilter")?;
370                map.serialize_entry(&"approximateFilter", value)?;
371            }
372            NumericSeries::DropNan(value) => {
373                map.serialize_entry(&"type", &"dropNan")?;
374                map.serialize_entry(&"dropNan", value)?;
375            }
376            NumericSeries::Select1dArrayIndex(value) => {
377                map.serialize_entry(&"type", &"select1dArrayIndex")?;
378                map.serialize_entry(&"select1dArrayIndex", value)?;
379            }
380            NumericSeries::AggregateUnderRanges(value) => {
381                map.serialize_entry(&"type", &"aggregateUnderRanges")?;
382                map.serialize_entry(&"aggregateUnderRanges", value)?;
383            }
384            NumericSeries::RangeDuration(value) => {
385                map.serialize_entry(&"type", &"rangeDuration")?;
386                map.serialize_entry(&"rangeDuration", value)?;
387            }
388            NumericSeries::GroupWithinRangesV2(value) => {
389                map.serialize_entry(&"type", &"groupWithinRangesV2")?;
390                map.serialize_entry(&"groupWithinRangesV2", value)?;
391            }
392            NumericSeries::FilterByExpression(value) => {
393                map.serialize_entry(&"type", &"filterByExpression")?;
394                map.serialize_entry(&"filterByExpression", value)?;
395            }
396            NumericSeries::ScalarUdf(value) => {
397                map.serialize_entry(&"type", &"scalarUdf")?;
398                map.serialize_entry(&"scalarUdf", value)?;
399            }
400            NumericSeries::EnumToNumeric(value) => {
401                map.serialize_entry(&"type", &"enumToNumeric")?;
402                map.serialize_entry(&"enumToNumeric", value)?;
403            }
404            NumericSeries::Contains(value) => {
405                map.serialize_entry(&"type", &"contains")?;
406                map.serialize_entry(&"contains", value)?;
407            }
408            NumericSeries::Refprop(value) => {
409                map.serialize_entry(&"type", &"refprop")?;
410                map.serialize_entry(&"refprop", value)?;
411            }
412            NumericSeries::RefpropV2(value) => {
413                map.serialize_entry(&"type", &"refpropV2")?;
414                map.serialize_entry(&"refpropV2", value)?;
415            }
416            NumericSeries::ExtractFromStruct(value) => {
417                map.serialize_entry(&"type", &"extractFromStruct")?;
418                map.serialize_entry(&"extractFromStruct", value)?;
419            }
420            NumericSeries::TagByIntervals(value) => {
421                map.serialize_entry(&"type", &"tagByIntervals")?;
422                map.serialize_entry(&"tagByIntervals", value)?;
423            }
424            NumericSeries::FilterByTag(value) => {
425                map.serialize_entry(&"type", &"filterByTag")?;
426                map.serialize_entry(&"filterByTag", value)?;
427            }
428            NumericSeries::SelectTags(value) => {
429                map.serialize_entry(&"type", &"selectTags")?;
430                map.serialize_entry(&"selectTags", value)?;
431            }
432            NumericSeries::ToStartOfInterval(value) => {
433                map.serialize_entry(&"type", &"toStartOfInterval")?;
434                map.serialize_entry(&"toStartOfInterval", value)?;
435            }
436            NumericSeries::PhaseUnwrap(value) => {
437                map.serialize_entry(&"type", &"phaseUnwrap")?;
438                map.serialize_entry(&"phaseUnwrap", value)?;
439            }
440            #[allow(deprecated)]
441            NumericSeries::Aggregate(value) => {
442                map.serialize_entry(&"type", &"aggregate")?;
443                map.serialize_entry(&"aggregate", value)?;
444            }
445            #[allow(deprecated)]
446            NumericSeries::RollingOperation(value) => {
447                map.serialize_entry(&"type", &"rollingOperation")?;
448                map.serialize_entry(&"rollingOperation", value)?;
449            }
450            #[allow(deprecated)]
451            NumericSeries::BitOperation(value) => {
452                map.serialize_entry(&"type", &"bitOperation")?;
453                map.serialize_entry(&"bitOperation", value)?;
454            }
455            #[allow(deprecated)]
456            NumericSeries::Channel(value) => {
457                map.serialize_entry(&"type", &"channel")?;
458                map.serialize_entry(&"channel", value)?;
459            }
460            #[allow(deprecated)]
461            NumericSeries::Offset(value) => {
462                map.serialize_entry(&"type", &"offset")?;
463                map.serialize_entry(&"offset", value)?;
464            }
465            #[allow(deprecated)]
466            NumericSeries::Scale(value) => {
467                map.serialize_entry(&"type", &"scale")?;
468                map.serialize_entry(&"scale", value)?;
469            }
470            #[allow(deprecated)]
471            NumericSeries::Arithmetic(value) => {
472                map.serialize_entry(&"type", &"arithmetic")?;
473                map.serialize_entry(&"arithmetic", value)?;
474            }
475            #[allow(deprecated)]
476            NumericSeries::UnaryArithmetic(value) => {
477                map.serialize_entry(&"type", &"unaryArithmetic")?;
478                map.serialize_entry(&"unaryArithmetic", value)?;
479            }
480            #[allow(deprecated)]
481            NumericSeries::BinaryArithmetic(value) => {
482                map.serialize_entry(&"type", &"binaryArithmetic")?;
483                map.serialize_entry(&"binaryArithmetic", value)?;
484            }
485            NumericSeries::Unknown(value) => {
486                map.serialize_entry(&"type", &value.type_)?;
487                map.serialize_entry(&value.type_, &value.value)?;
488            }
489        }
490        map.end()
491    }
492}
493impl<'de> de::Deserialize<'de> for NumericSeries {
494    fn deserialize<D>(d: D) -> Result<NumericSeries, D::Error>
495    where
496        D: de::Deserializer<'de>,
497    {
498        d.deserialize_map(Visitor_)
499    }
500}
501struct Visitor_;
502impl<'de> de::Visitor<'de> for Visitor_ {
503    type Value = NumericSeries;
504    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
505        fmt.write_str("union NumericSeries")
506    }
507    fn visit_map<A>(self, mut map: A) -> Result<NumericSeries, A::Error>
508    where
509        A: de::MapAccess<'de>,
510    {
511        let v = match map.next_key::<UnionField_<Variant_>>()? {
512            Some(UnionField_::Type) => {
513                let variant = map.next_value()?;
514                let key = map.next_key()?;
515                match (variant, key) {
516                    (Variant_::Abs, Some(Variant_::Abs)) => {
517                        let value = map.next_value()?;
518                        NumericSeries::Abs(value)
519                    }
520                    (Variant_::Negate, Some(Variant_::Negate)) => {
521                        let value = map.next_value()?;
522                        NumericSeries::Negate(value)
523                    }
524                    (Variant_::Cos, Some(Variant_::Cos)) => {
525                        let value = map.next_value()?;
526                        NumericSeries::Cos(value)
527                    }
528                    (Variant_::Sin, Some(Variant_::Sin)) => {
529                        let value = map.next_value()?;
530                        NumericSeries::Sin(value)
531                    }
532                    (Variant_::Tan, Some(Variant_::Tan)) => {
533                        let value = map.next_value()?;
534                        NumericSeries::Tan(value)
535                    }
536                    (Variant_::Acos, Some(Variant_::Acos)) => {
537                        let value = map.next_value()?;
538                        NumericSeries::Acos(value)
539                    }
540                    (Variant_::Asin, Some(Variant_::Asin)) => {
541                        let value = map.next_value()?;
542                        NumericSeries::Asin(value)
543                    }
544                    (Variant_::Ln, Some(Variant_::Ln)) => {
545                        let value = map.next_value()?;
546                        NumericSeries::Ln(value)
547                    }
548                    (Variant_::Log10, Some(Variant_::Log10)) => {
549                        let value = map.next_value()?;
550                        NumericSeries::Log10(value)
551                    }
552                    (Variant_::Sqrt, Some(Variant_::Sqrt)) => {
553                        let value = map.next_value()?;
554                        NumericSeries::Sqrt(value)
555                    }
556                    (Variant_::Add, Some(Variant_::Add)) => {
557                        let value = map.next_value()?;
558                        NumericSeries::Add(value)
559                    }
560                    (Variant_::Subtract, Some(Variant_::Subtract)) => {
561                        let value = map.next_value()?;
562                        NumericSeries::Subtract(value)
563                    }
564                    (Variant_::Multiply, Some(Variant_::Multiply)) => {
565                        let value = map.next_value()?;
566                        NumericSeries::Multiply(value)
567                    }
568                    (Variant_::Divide, Some(Variant_::Divide)) => {
569                        let value = map.next_value()?;
570                        NumericSeries::Divide(value)
571                    }
572                    (Variant_::FloorDivide, Some(Variant_::FloorDivide)) => {
573                        let value = map.next_value()?;
574                        NumericSeries::FloorDivide(value)
575                    }
576                    (Variant_::Power, Some(Variant_::Power)) => {
577                        let value = map.next_value()?;
578                        NumericSeries::Power(value)
579                    }
580                    (Variant_::Modulo, Some(Variant_::Modulo)) => {
581                        let value = map.next_value()?;
582                        NumericSeries::Modulo(value)
583                    }
584                    (Variant_::Atan2, Some(Variant_::Atan2)) => {
585                        let value = map.next_value()?;
586                        NumericSeries::Atan2(value)
587                    }
588                    (Variant_::Max, Some(Variant_::Max)) => {
589                        let value = map.next_value()?;
590                        NumericSeries::Max(value)
591                    }
592                    (Variant_::Mean, Some(Variant_::Mean)) => {
593                        let value = map.next_value()?;
594                        NumericSeries::Mean(value)
595                    }
596                    (Variant_::Min, Some(Variant_::Min)) => {
597                        let value = map.next_value()?;
598                        NumericSeries::Min(value)
599                    }
600                    (Variant_::Sum, Some(Variant_::Sum)) => {
601                        let value = map.next_value()?;
602                        NumericSeries::Sum(value)
603                    }
604                    (Variant_::Union, Some(Variant_::Union)) => {
605                        let value = map.next_value()?;
606                        NumericSeries::Union(value)
607                    }
608                    (Variant_::Product, Some(Variant_::Product)) => {
609                        let value = map.next_value()?;
610                        NumericSeries::Product(value)
611                    }
612                    (Variant_::Constant, Some(Variant_::Constant)) => {
613                        let value = map.next_value()?;
614                        NumericSeries::Constant(value)
615                    }
616                    (
617                        Variant_::SelectNewestPoints,
618                        Some(Variant_::SelectNewestPoints),
619                    ) => {
620                        let value = map.next_value()?;
621                        NumericSeries::SelectNewestPoints(value)
622                    }
623                    (Variant_::SelectNumeric, Some(Variant_::SelectNumeric)) => {
624                        let value = map.next_value()?;
625                        NumericSeries::SelectNumeric(value)
626                    }
627                    (
628                        Variant_::SelectNumericProperty,
629                        Some(Variant_::SelectNumericProperty),
630                    ) => {
631                        let value = map.next_value()?;
632                        NumericSeries::SelectNumericProperty(value)
633                    }
634                    (
635                        Variant_::SelectOldestPoints,
636                        Some(Variant_::SelectOldestPoints),
637                    ) => {
638                        let value = map.next_value()?;
639                        NumericSeries::SelectOldestPoints(value)
640                    }
641                    (Variant_::BitAnd, Some(Variant_::BitAnd)) => {
642                        let value = map.next_value()?;
643                        NumericSeries::BitAnd(value)
644                    }
645                    (Variant_::BitOr, Some(Variant_::BitOr)) => {
646                        let value = map.next_value()?;
647                        NumericSeries::BitOr(value)
648                    }
649                    (Variant_::BitXor, Some(Variant_::BitXor)) => {
650                        let value = map.next_value()?;
651                        NumericSeries::BitXor(value)
652                    }
653                    (Variant_::BitShiftRight, Some(Variant_::BitShiftRight)) => {
654                        let value = map.next_value()?;
655                        NumericSeries::BitShiftRight(value)
656                    }
657                    (Variant_::BitShiftLeft, Some(Variant_::BitShiftLeft)) => {
658                        let value = map.next_value()?;
659                        NumericSeries::BitShiftLeft(value)
660                    }
661                    (Variant_::BitTest, Some(Variant_::BitTest)) => {
662                        let value = map.next_value()?;
663                        NumericSeries::BitTest(value)
664                    }
665                    (Variant_::IfElse, Some(Variant_::IfElse)) => {
666                        let value = map.next_value()?;
667                        NumericSeries::IfElse(value)
668                    }
669                    (
670                        Variant_::NumericAggregation,
671                        Some(Variant_::NumericAggregation),
672                    ) => {
673                        let value = map.next_value()?;
674                        NumericSeries::NumericAggregation(value)
675                    }
676                    (Variant_::CountDuplicate, Some(Variant_::CountDuplicate)) => {
677                        let value = map.next_value()?;
678                        NumericSeries::CountDuplicate(value)
679                    }
680                    (Variant_::CumulativeSum, Some(Variant_::CumulativeSum)) => {
681                        let value = map.next_value()?;
682                        NumericSeries::CumulativeSum(value)
683                    }
684                    (Variant_::Derivative, Some(Variant_::Derivative)) => {
685                        let value = map.next_value()?;
686                        NumericSeries::Derivative(value)
687                    }
688                    (Variant_::Integral, Some(Variant_::Integral)) => {
689                        let value = map.next_value()?;
690                        NumericSeries::Integral(value)
691                    }
692                    (Variant_::ZScore, Some(Variant_::ZScore)) => {
693                        let value = map.next_value()?;
694                        NumericSeries::ZScore(value)
695                    }
696                    (Variant_::Raw, Some(Variant_::Raw)) => {
697                        let value = map.next_value()?;
698                        NumericSeries::Raw(value)
699                    }
700                    (Variant_::Derived, Some(Variant_::Derived)) => {
701                        let value = map.next_value()?;
702                        NumericSeries::Derived(value)
703                    }
704                    (Variant_::Resample, Some(Variant_::Resample)) => {
705                        let value = map.next_value()?;
706                        NumericSeries::Resample(value)
707                    }
708                    (Variant_::ResampleV2, Some(Variant_::ResampleV2)) => {
709                        let value = map.next_value()?;
710                        NumericSeries::ResampleV2(value)
711                    }
712                    (
713                        Variant_::NthPointDownsample,
714                        Some(Variant_::NthPointDownsample),
715                    ) => {
716                        let value = map.next_value()?;
717                        NumericSeries::NthPointDownsample(value)
718                    }
719                    (
720                        Variant_::LargestTriangleThreeBuckets,
721                        Some(Variant_::LargestTriangleThreeBuckets),
722                    ) => {
723                        let value = map.next_value()?;
724                        NumericSeries::LargestTriangleThreeBuckets(value)
725                    }
726                    (Variant_::SignalFilter, Some(Variant_::SignalFilter)) => {
727                        let value = map.next_value()?;
728                        NumericSeries::SignalFilter(value)
729                    }
730                    (Variant_::TimeDifference, Some(Variant_::TimeDifference)) => {
731                        let value = map.next_value()?;
732                        NumericSeries::TimeDifference(value)
733                    }
734                    (Variant_::AbsoluteTimestamp, Some(Variant_::AbsoluteTimestamp)) => {
735                        let value = map.next_value()?;
736                        NumericSeries::AbsoluteTimestamp(value)
737                    }
738                    (Variant_::TimeRangeFilter, Some(Variant_::TimeRangeFilter)) => {
739                        let value = map.next_value()?;
740                        NumericSeries::TimeRangeFilter(value)
741                    }
742                    (Variant_::TimeShift, Some(Variant_::TimeShift)) => {
743                        let value = map.next_value()?;
744                        NumericSeries::TimeShift(value)
745                    }
746                    (Variant_::TimeShiftV2, Some(Variant_::TimeShiftV2)) => {
747                        let value = map.next_value()?;
748                        NumericSeries::TimeShiftV2(value)
749                    }
750                    (Variant_::UnitConversion, Some(Variant_::UnitConversion)) => {
751                        let value = map.next_value()?;
752                        NumericSeries::UnitConversion(value)
753                    }
754                    (Variant_::UnitOverride, Some(Variant_::UnitOverride)) => {
755                        let value = map.next_value()?;
756                        NumericSeries::UnitOverride(value)
757                    }
758                    (Variant_::ValueDifference, Some(Variant_::ValueDifference)) => {
759                        let value = map.next_value()?;
760                        NumericSeries::ValueDifference(value)
761                    }
762                    (
763                        Variant_::FilterTransformation,
764                        Some(Variant_::FilterTransformation),
765                    ) => {
766                        let value = map.next_value()?;
767                        NumericSeries::FilterTransformation(value)
768                    }
769                    (Variant_::FilterWhere, Some(Variant_::FilterWhere)) => {
770                        let value = map.next_value()?;
771                        NumericSeries::FilterWhere(value)
772                    }
773                    (Variant_::ThresholdFilter, Some(Variant_::ThresholdFilter)) => {
774                        let value = map.next_value()?;
775                        NumericSeries::ThresholdFilter(value)
776                    }
777                    (Variant_::ApproximateFilter, Some(Variant_::ApproximateFilter)) => {
778                        let value = map.next_value()?;
779                        NumericSeries::ApproximateFilter(value)
780                    }
781                    (Variant_::DropNan, Some(Variant_::DropNan)) => {
782                        let value = map.next_value()?;
783                        NumericSeries::DropNan(value)
784                    }
785                    (
786                        Variant_::Select1dArrayIndex,
787                        Some(Variant_::Select1dArrayIndex),
788                    ) => {
789                        let value = map.next_value()?;
790                        NumericSeries::Select1dArrayIndex(value)
791                    }
792                    (
793                        Variant_::AggregateUnderRanges,
794                        Some(Variant_::AggregateUnderRanges),
795                    ) => {
796                        let value = map.next_value()?;
797                        NumericSeries::AggregateUnderRanges(value)
798                    }
799                    (Variant_::RangeDuration, Some(Variant_::RangeDuration)) => {
800                        let value = map.next_value()?;
801                        NumericSeries::RangeDuration(value)
802                    }
803                    (
804                        Variant_::GroupWithinRangesV2,
805                        Some(Variant_::GroupWithinRangesV2),
806                    ) => {
807                        let value = map.next_value()?;
808                        NumericSeries::GroupWithinRangesV2(value)
809                    }
810                    (
811                        Variant_::FilterByExpression,
812                        Some(Variant_::FilterByExpression),
813                    ) => {
814                        let value = map.next_value()?;
815                        NumericSeries::FilterByExpression(value)
816                    }
817                    (Variant_::ScalarUdf, Some(Variant_::ScalarUdf)) => {
818                        let value = map.next_value()?;
819                        NumericSeries::ScalarUdf(value)
820                    }
821                    (Variant_::EnumToNumeric, Some(Variant_::EnumToNumeric)) => {
822                        let value = map.next_value()?;
823                        NumericSeries::EnumToNumeric(value)
824                    }
825                    (Variant_::Contains, Some(Variant_::Contains)) => {
826                        let value = map.next_value()?;
827                        NumericSeries::Contains(value)
828                    }
829                    (Variant_::Refprop, Some(Variant_::Refprop)) => {
830                        let value = map.next_value()?;
831                        NumericSeries::Refprop(value)
832                    }
833                    (Variant_::RefpropV2, Some(Variant_::RefpropV2)) => {
834                        let value = map.next_value()?;
835                        NumericSeries::RefpropV2(value)
836                    }
837                    (Variant_::ExtractFromStruct, Some(Variant_::ExtractFromStruct)) => {
838                        let value = map.next_value()?;
839                        NumericSeries::ExtractFromStruct(value)
840                    }
841                    (Variant_::TagByIntervals, Some(Variant_::TagByIntervals)) => {
842                        let value = map.next_value()?;
843                        NumericSeries::TagByIntervals(value)
844                    }
845                    (Variant_::FilterByTag, Some(Variant_::FilterByTag)) => {
846                        let value = map.next_value()?;
847                        NumericSeries::FilterByTag(value)
848                    }
849                    (Variant_::SelectTags, Some(Variant_::SelectTags)) => {
850                        let value = map.next_value()?;
851                        NumericSeries::SelectTags(value)
852                    }
853                    (Variant_::ToStartOfInterval, Some(Variant_::ToStartOfInterval)) => {
854                        let value = map.next_value()?;
855                        NumericSeries::ToStartOfInterval(value)
856                    }
857                    (Variant_::PhaseUnwrap, Some(Variant_::PhaseUnwrap)) => {
858                        let value = map.next_value()?;
859                        NumericSeries::PhaseUnwrap(value)
860                    }
861                    #[allow(deprecated)]
862                    (Variant_::Aggregate, Some(Variant_::Aggregate)) => {
863                        let value = map.next_value()?;
864                        NumericSeries::Aggregate(value)
865                    }
866                    #[allow(deprecated)]
867                    (Variant_::RollingOperation, Some(Variant_::RollingOperation)) => {
868                        let value = map.next_value()?;
869                        NumericSeries::RollingOperation(value)
870                    }
871                    #[allow(deprecated)]
872                    (Variant_::BitOperation, Some(Variant_::BitOperation)) => {
873                        let value = map.next_value()?;
874                        NumericSeries::BitOperation(value)
875                    }
876                    #[allow(deprecated)]
877                    (Variant_::Channel, Some(Variant_::Channel)) => {
878                        let value = map.next_value()?;
879                        NumericSeries::Channel(value)
880                    }
881                    #[allow(deprecated)]
882                    (Variant_::Offset, Some(Variant_::Offset)) => {
883                        let value = map.next_value()?;
884                        NumericSeries::Offset(value)
885                    }
886                    #[allow(deprecated)]
887                    (Variant_::Scale, Some(Variant_::Scale)) => {
888                        let value = map.next_value()?;
889                        NumericSeries::Scale(value)
890                    }
891                    #[allow(deprecated)]
892                    (Variant_::Arithmetic, Some(Variant_::Arithmetic)) => {
893                        let value = map.next_value()?;
894                        NumericSeries::Arithmetic(value)
895                    }
896                    #[allow(deprecated)]
897                    (Variant_::UnaryArithmetic, Some(Variant_::UnaryArithmetic)) => {
898                        let value = map.next_value()?;
899                        NumericSeries::UnaryArithmetic(value)
900                    }
901                    #[allow(deprecated)]
902                    (Variant_::BinaryArithmetic, Some(Variant_::BinaryArithmetic)) => {
903                        let value = map.next_value()?;
904                        NumericSeries::BinaryArithmetic(value)
905                    }
906                    (Variant_::Unknown(type_), Some(Variant_::Unknown(b))) => {
907                        if type_ == b {
908                            let value = map.next_value()?;
909                            NumericSeries::Unknown(Unknown { type_, value })
910                        } else {
911                            return Err(
912                                de::Error::invalid_value(de::Unexpected::Str(&type_), &&*b),
913                            )
914                        }
915                    }
916                    (variant, Some(key)) => {
917                        return Err(
918                            de::Error::invalid_value(
919                                de::Unexpected::Str(key.as_str()),
920                                &variant.as_str(),
921                            ),
922                        );
923                    }
924                    (variant, None) => {
925                        return Err(de::Error::missing_field(variant.as_str()));
926                    }
927                }
928            }
929            Some(UnionField_::Value(variant)) => {
930                let value = match &variant {
931                    Variant_::Abs => {
932                        let value = map.next_value()?;
933                        NumericSeries::Abs(value)
934                    }
935                    Variant_::Negate => {
936                        let value = map.next_value()?;
937                        NumericSeries::Negate(value)
938                    }
939                    Variant_::Cos => {
940                        let value = map.next_value()?;
941                        NumericSeries::Cos(value)
942                    }
943                    Variant_::Sin => {
944                        let value = map.next_value()?;
945                        NumericSeries::Sin(value)
946                    }
947                    Variant_::Tan => {
948                        let value = map.next_value()?;
949                        NumericSeries::Tan(value)
950                    }
951                    Variant_::Acos => {
952                        let value = map.next_value()?;
953                        NumericSeries::Acos(value)
954                    }
955                    Variant_::Asin => {
956                        let value = map.next_value()?;
957                        NumericSeries::Asin(value)
958                    }
959                    Variant_::Ln => {
960                        let value = map.next_value()?;
961                        NumericSeries::Ln(value)
962                    }
963                    Variant_::Log10 => {
964                        let value = map.next_value()?;
965                        NumericSeries::Log10(value)
966                    }
967                    Variant_::Sqrt => {
968                        let value = map.next_value()?;
969                        NumericSeries::Sqrt(value)
970                    }
971                    Variant_::Add => {
972                        let value = map.next_value()?;
973                        NumericSeries::Add(value)
974                    }
975                    Variant_::Subtract => {
976                        let value = map.next_value()?;
977                        NumericSeries::Subtract(value)
978                    }
979                    Variant_::Multiply => {
980                        let value = map.next_value()?;
981                        NumericSeries::Multiply(value)
982                    }
983                    Variant_::Divide => {
984                        let value = map.next_value()?;
985                        NumericSeries::Divide(value)
986                    }
987                    Variant_::FloorDivide => {
988                        let value = map.next_value()?;
989                        NumericSeries::FloorDivide(value)
990                    }
991                    Variant_::Power => {
992                        let value = map.next_value()?;
993                        NumericSeries::Power(value)
994                    }
995                    Variant_::Modulo => {
996                        let value = map.next_value()?;
997                        NumericSeries::Modulo(value)
998                    }
999                    Variant_::Atan2 => {
1000                        let value = map.next_value()?;
1001                        NumericSeries::Atan2(value)
1002                    }
1003                    Variant_::Max => {
1004                        let value = map.next_value()?;
1005                        NumericSeries::Max(value)
1006                    }
1007                    Variant_::Mean => {
1008                        let value = map.next_value()?;
1009                        NumericSeries::Mean(value)
1010                    }
1011                    Variant_::Min => {
1012                        let value = map.next_value()?;
1013                        NumericSeries::Min(value)
1014                    }
1015                    Variant_::Sum => {
1016                        let value = map.next_value()?;
1017                        NumericSeries::Sum(value)
1018                    }
1019                    Variant_::Union => {
1020                        let value = map.next_value()?;
1021                        NumericSeries::Union(value)
1022                    }
1023                    Variant_::Product => {
1024                        let value = map.next_value()?;
1025                        NumericSeries::Product(value)
1026                    }
1027                    Variant_::Constant => {
1028                        let value = map.next_value()?;
1029                        NumericSeries::Constant(value)
1030                    }
1031                    Variant_::SelectNewestPoints => {
1032                        let value = map.next_value()?;
1033                        NumericSeries::SelectNewestPoints(value)
1034                    }
1035                    Variant_::SelectNumeric => {
1036                        let value = map.next_value()?;
1037                        NumericSeries::SelectNumeric(value)
1038                    }
1039                    Variant_::SelectNumericProperty => {
1040                        let value = map.next_value()?;
1041                        NumericSeries::SelectNumericProperty(value)
1042                    }
1043                    Variant_::SelectOldestPoints => {
1044                        let value = map.next_value()?;
1045                        NumericSeries::SelectOldestPoints(value)
1046                    }
1047                    Variant_::BitAnd => {
1048                        let value = map.next_value()?;
1049                        NumericSeries::BitAnd(value)
1050                    }
1051                    Variant_::BitOr => {
1052                        let value = map.next_value()?;
1053                        NumericSeries::BitOr(value)
1054                    }
1055                    Variant_::BitXor => {
1056                        let value = map.next_value()?;
1057                        NumericSeries::BitXor(value)
1058                    }
1059                    Variant_::BitShiftRight => {
1060                        let value = map.next_value()?;
1061                        NumericSeries::BitShiftRight(value)
1062                    }
1063                    Variant_::BitShiftLeft => {
1064                        let value = map.next_value()?;
1065                        NumericSeries::BitShiftLeft(value)
1066                    }
1067                    Variant_::BitTest => {
1068                        let value = map.next_value()?;
1069                        NumericSeries::BitTest(value)
1070                    }
1071                    Variant_::IfElse => {
1072                        let value = map.next_value()?;
1073                        NumericSeries::IfElse(value)
1074                    }
1075                    Variant_::NumericAggregation => {
1076                        let value = map.next_value()?;
1077                        NumericSeries::NumericAggregation(value)
1078                    }
1079                    Variant_::CountDuplicate => {
1080                        let value = map.next_value()?;
1081                        NumericSeries::CountDuplicate(value)
1082                    }
1083                    Variant_::CumulativeSum => {
1084                        let value = map.next_value()?;
1085                        NumericSeries::CumulativeSum(value)
1086                    }
1087                    Variant_::Derivative => {
1088                        let value = map.next_value()?;
1089                        NumericSeries::Derivative(value)
1090                    }
1091                    Variant_::Integral => {
1092                        let value = map.next_value()?;
1093                        NumericSeries::Integral(value)
1094                    }
1095                    Variant_::ZScore => {
1096                        let value = map.next_value()?;
1097                        NumericSeries::ZScore(value)
1098                    }
1099                    Variant_::Raw => {
1100                        let value = map.next_value()?;
1101                        NumericSeries::Raw(value)
1102                    }
1103                    Variant_::Derived => {
1104                        let value = map.next_value()?;
1105                        NumericSeries::Derived(value)
1106                    }
1107                    Variant_::Resample => {
1108                        let value = map.next_value()?;
1109                        NumericSeries::Resample(value)
1110                    }
1111                    Variant_::ResampleV2 => {
1112                        let value = map.next_value()?;
1113                        NumericSeries::ResampleV2(value)
1114                    }
1115                    Variant_::NthPointDownsample => {
1116                        let value = map.next_value()?;
1117                        NumericSeries::NthPointDownsample(value)
1118                    }
1119                    Variant_::LargestTriangleThreeBuckets => {
1120                        let value = map.next_value()?;
1121                        NumericSeries::LargestTriangleThreeBuckets(value)
1122                    }
1123                    Variant_::SignalFilter => {
1124                        let value = map.next_value()?;
1125                        NumericSeries::SignalFilter(value)
1126                    }
1127                    Variant_::TimeDifference => {
1128                        let value = map.next_value()?;
1129                        NumericSeries::TimeDifference(value)
1130                    }
1131                    Variant_::AbsoluteTimestamp => {
1132                        let value = map.next_value()?;
1133                        NumericSeries::AbsoluteTimestamp(value)
1134                    }
1135                    Variant_::TimeRangeFilter => {
1136                        let value = map.next_value()?;
1137                        NumericSeries::TimeRangeFilter(value)
1138                    }
1139                    Variant_::TimeShift => {
1140                        let value = map.next_value()?;
1141                        NumericSeries::TimeShift(value)
1142                    }
1143                    Variant_::TimeShiftV2 => {
1144                        let value = map.next_value()?;
1145                        NumericSeries::TimeShiftV2(value)
1146                    }
1147                    Variant_::UnitConversion => {
1148                        let value = map.next_value()?;
1149                        NumericSeries::UnitConversion(value)
1150                    }
1151                    Variant_::UnitOverride => {
1152                        let value = map.next_value()?;
1153                        NumericSeries::UnitOverride(value)
1154                    }
1155                    Variant_::ValueDifference => {
1156                        let value = map.next_value()?;
1157                        NumericSeries::ValueDifference(value)
1158                    }
1159                    Variant_::FilterTransformation => {
1160                        let value = map.next_value()?;
1161                        NumericSeries::FilterTransformation(value)
1162                    }
1163                    Variant_::FilterWhere => {
1164                        let value = map.next_value()?;
1165                        NumericSeries::FilterWhere(value)
1166                    }
1167                    Variant_::ThresholdFilter => {
1168                        let value = map.next_value()?;
1169                        NumericSeries::ThresholdFilter(value)
1170                    }
1171                    Variant_::ApproximateFilter => {
1172                        let value = map.next_value()?;
1173                        NumericSeries::ApproximateFilter(value)
1174                    }
1175                    Variant_::DropNan => {
1176                        let value = map.next_value()?;
1177                        NumericSeries::DropNan(value)
1178                    }
1179                    Variant_::Select1dArrayIndex => {
1180                        let value = map.next_value()?;
1181                        NumericSeries::Select1dArrayIndex(value)
1182                    }
1183                    Variant_::AggregateUnderRanges => {
1184                        let value = map.next_value()?;
1185                        NumericSeries::AggregateUnderRanges(value)
1186                    }
1187                    Variant_::RangeDuration => {
1188                        let value = map.next_value()?;
1189                        NumericSeries::RangeDuration(value)
1190                    }
1191                    Variant_::GroupWithinRangesV2 => {
1192                        let value = map.next_value()?;
1193                        NumericSeries::GroupWithinRangesV2(value)
1194                    }
1195                    Variant_::FilterByExpression => {
1196                        let value = map.next_value()?;
1197                        NumericSeries::FilterByExpression(value)
1198                    }
1199                    Variant_::ScalarUdf => {
1200                        let value = map.next_value()?;
1201                        NumericSeries::ScalarUdf(value)
1202                    }
1203                    Variant_::EnumToNumeric => {
1204                        let value = map.next_value()?;
1205                        NumericSeries::EnumToNumeric(value)
1206                    }
1207                    Variant_::Contains => {
1208                        let value = map.next_value()?;
1209                        NumericSeries::Contains(value)
1210                    }
1211                    Variant_::Refprop => {
1212                        let value = map.next_value()?;
1213                        NumericSeries::Refprop(value)
1214                    }
1215                    Variant_::RefpropV2 => {
1216                        let value = map.next_value()?;
1217                        NumericSeries::RefpropV2(value)
1218                    }
1219                    Variant_::ExtractFromStruct => {
1220                        let value = map.next_value()?;
1221                        NumericSeries::ExtractFromStruct(value)
1222                    }
1223                    Variant_::TagByIntervals => {
1224                        let value = map.next_value()?;
1225                        NumericSeries::TagByIntervals(value)
1226                    }
1227                    Variant_::FilterByTag => {
1228                        let value = map.next_value()?;
1229                        NumericSeries::FilterByTag(value)
1230                    }
1231                    Variant_::SelectTags => {
1232                        let value = map.next_value()?;
1233                        NumericSeries::SelectTags(value)
1234                    }
1235                    Variant_::ToStartOfInterval => {
1236                        let value = map.next_value()?;
1237                        NumericSeries::ToStartOfInterval(value)
1238                    }
1239                    Variant_::PhaseUnwrap => {
1240                        let value = map.next_value()?;
1241                        NumericSeries::PhaseUnwrap(value)
1242                    }
1243                    Variant_::Aggregate => {
1244                        let value = map.next_value()?;
1245                        #[allow(deprecated)] NumericSeries::Aggregate(value)
1246                    }
1247                    Variant_::RollingOperation => {
1248                        let value = map.next_value()?;
1249                        #[allow(deprecated)] NumericSeries::RollingOperation(value)
1250                    }
1251                    Variant_::BitOperation => {
1252                        let value = map.next_value()?;
1253                        #[allow(deprecated)] NumericSeries::BitOperation(value)
1254                    }
1255                    Variant_::Channel => {
1256                        let value = map.next_value()?;
1257                        #[allow(deprecated)] NumericSeries::Channel(value)
1258                    }
1259                    Variant_::Offset => {
1260                        let value = map.next_value()?;
1261                        #[allow(deprecated)] NumericSeries::Offset(value)
1262                    }
1263                    Variant_::Scale => {
1264                        let value = map.next_value()?;
1265                        #[allow(deprecated)] NumericSeries::Scale(value)
1266                    }
1267                    Variant_::Arithmetic => {
1268                        let value = map.next_value()?;
1269                        #[allow(deprecated)] NumericSeries::Arithmetic(value)
1270                    }
1271                    Variant_::UnaryArithmetic => {
1272                        let value = map.next_value()?;
1273                        #[allow(deprecated)] NumericSeries::UnaryArithmetic(value)
1274                    }
1275                    Variant_::BinaryArithmetic => {
1276                        let value = map.next_value()?;
1277                        #[allow(deprecated)] NumericSeries::BinaryArithmetic(value)
1278                    }
1279                    Variant_::Unknown(type_) => {
1280                        let value = map.next_value()?;
1281                        NumericSeries::Unknown(Unknown {
1282                            type_: type_.clone(),
1283                            value,
1284                        })
1285                    }
1286                };
1287                if map.next_key::<UnionTypeField_>()?.is_none() {
1288                    return Err(de::Error::missing_field("type"));
1289                }
1290                let type_variant = map.next_value::<Variant_>()?;
1291                if variant != type_variant {
1292                    return Err(
1293                        de::Error::invalid_value(
1294                            de::Unexpected::Str(type_variant.as_str()),
1295                            &variant.as_str(),
1296                        ),
1297                    );
1298                }
1299                value
1300            }
1301            None => return Err(de::Error::missing_field("type")),
1302        };
1303        if map.next_key::<UnionField_<Variant_>>()?.is_some() {
1304            return Err(de::Error::invalid_length(3, &"type and value fields"));
1305        }
1306        Ok(v)
1307    }
1308}
1309#[derive(PartialEq)]
1310enum Variant_ {
1311    Abs,
1312    Negate,
1313    Cos,
1314    Sin,
1315    Tan,
1316    Acos,
1317    Asin,
1318    Ln,
1319    Log10,
1320    Sqrt,
1321    Add,
1322    Subtract,
1323    Multiply,
1324    Divide,
1325    FloorDivide,
1326    Power,
1327    Modulo,
1328    Atan2,
1329    Max,
1330    Mean,
1331    Min,
1332    Sum,
1333    Union,
1334    Product,
1335    Constant,
1336    SelectNewestPoints,
1337    SelectNumeric,
1338    SelectNumericProperty,
1339    SelectOldestPoints,
1340    BitAnd,
1341    BitOr,
1342    BitXor,
1343    BitShiftRight,
1344    BitShiftLeft,
1345    BitTest,
1346    IfElse,
1347    NumericAggregation,
1348    CountDuplicate,
1349    CumulativeSum,
1350    Derivative,
1351    Integral,
1352    ZScore,
1353    Raw,
1354    Derived,
1355    Resample,
1356    ResampleV2,
1357    NthPointDownsample,
1358    LargestTriangleThreeBuckets,
1359    SignalFilter,
1360    TimeDifference,
1361    AbsoluteTimestamp,
1362    TimeRangeFilter,
1363    TimeShift,
1364    TimeShiftV2,
1365    UnitConversion,
1366    UnitOverride,
1367    ValueDifference,
1368    FilterTransformation,
1369    FilterWhere,
1370    ThresholdFilter,
1371    ApproximateFilter,
1372    DropNan,
1373    Select1dArrayIndex,
1374    AggregateUnderRanges,
1375    RangeDuration,
1376    GroupWithinRangesV2,
1377    FilterByExpression,
1378    ScalarUdf,
1379    EnumToNumeric,
1380    Contains,
1381    Refprop,
1382    RefpropV2,
1383    ExtractFromStruct,
1384    TagByIntervals,
1385    FilterByTag,
1386    SelectTags,
1387    ToStartOfInterval,
1388    PhaseUnwrap,
1389    Aggregate,
1390    RollingOperation,
1391    BitOperation,
1392    Channel,
1393    Offset,
1394    Scale,
1395    Arithmetic,
1396    UnaryArithmetic,
1397    BinaryArithmetic,
1398    Unknown(Box<str>),
1399}
1400impl Variant_ {
1401    fn as_str(&self) -> &'static str {
1402        match *self {
1403            Variant_::Abs => "abs",
1404            Variant_::Negate => "negate",
1405            Variant_::Cos => "cos",
1406            Variant_::Sin => "sin",
1407            Variant_::Tan => "tan",
1408            Variant_::Acos => "acos",
1409            Variant_::Asin => "asin",
1410            Variant_::Ln => "ln",
1411            Variant_::Log10 => "log10",
1412            Variant_::Sqrt => "sqrt",
1413            Variant_::Add => "add",
1414            Variant_::Subtract => "subtract",
1415            Variant_::Multiply => "multiply",
1416            Variant_::Divide => "divide",
1417            Variant_::FloorDivide => "floorDivide",
1418            Variant_::Power => "power",
1419            Variant_::Modulo => "modulo",
1420            Variant_::Atan2 => "atan2",
1421            Variant_::Max => "max",
1422            Variant_::Mean => "mean",
1423            Variant_::Min => "min",
1424            Variant_::Sum => "sum",
1425            Variant_::Union => "union",
1426            Variant_::Product => "product",
1427            Variant_::Constant => "constant",
1428            Variant_::SelectNewestPoints => "selectNewestPoints",
1429            Variant_::SelectNumeric => "selectNumeric",
1430            Variant_::SelectNumericProperty => "selectNumericProperty",
1431            Variant_::SelectOldestPoints => "selectOldestPoints",
1432            Variant_::BitAnd => "bitAnd",
1433            Variant_::BitOr => "bitOr",
1434            Variant_::BitXor => "bitXor",
1435            Variant_::BitShiftRight => "bitShiftRight",
1436            Variant_::BitShiftLeft => "bitShiftLeft",
1437            Variant_::BitTest => "bitTest",
1438            Variant_::IfElse => "ifElse",
1439            Variant_::NumericAggregation => "numericAggregation",
1440            Variant_::CountDuplicate => "countDuplicate",
1441            Variant_::CumulativeSum => "cumulativeSum",
1442            Variant_::Derivative => "derivative",
1443            Variant_::Integral => "integral",
1444            Variant_::ZScore => "zScore",
1445            Variant_::Raw => "raw",
1446            Variant_::Derived => "derived",
1447            Variant_::Resample => "resample",
1448            Variant_::ResampleV2 => "resampleV2",
1449            Variant_::NthPointDownsample => "nthPointDownsample",
1450            Variant_::LargestTriangleThreeBuckets => "largestTriangleThreeBuckets",
1451            Variant_::SignalFilter => "signalFilter",
1452            Variant_::TimeDifference => "timeDifference",
1453            Variant_::AbsoluteTimestamp => "absoluteTimestamp",
1454            Variant_::TimeRangeFilter => "timeRangeFilter",
1455            Variant_::TimeShift => "timeShift",
1456            Variant_::TimeShiftV2 => "timeShiftV2",
1457            Variant_::UnitConversion => "unitConversion",
1458            Variant_::UnitOverride => "unitOverride",
1459            Variant_::ValueDifference => "valueDifference",
1460            Variant_::FilterTransformation => "filterTransformation",
1461            Variant_::FilterWhere => "filterWhere",
1462            Variant_::ThresholdFilter => "thresholdFilter",
1463            Variant_::ApproximateFilter => "approximateFilter",
1464            Variant_::DropNan => "dropNan",
1465            Variant_::Select1dArrayIndex => "select1dArrayIndex",
1466            Variant_::AggregateUnderRanges => "aggregateUnderRanges",
1467            Variant_::RangeDuration => "rangeDuration",
1468            Variant_::GroupWithinRangesV2 => "groupWithinRangesV2",
1469            Variant_::FilterByExpression => "filterByExpression",
1470            Variant_::ScalarUdf => "scalarUdf",
1471            Variant_::EnumToNumeric => "enumToNumeric",
1472            Variant_::Contains => "contains",
1473            Variant_::Refprop => "refprop",
1474            Variant_::RefpropV2 => "refpropV2",
1475            Variant_::ExtractFromStruct => "extractFromStruct",
1476            Variant_::TagByIntervals => "tagByIntervals",
1477            Variant_::FilterByTag => "filterByTag",
1478            Variant_::SelectTags => "selectTags",
1479            Variant_::ToStartOfInterval => "toStartOfInterval",
1480            Variant_::PhaseUnwrap => "phaseUnwrap",
1481            Variant_::Aggregate => "aggregate",
1482            Variant_::RollingOperation => "rollingOperation",
1483            Variant_::BitOperation => "bitOperation",
1484            Variant_::Channel => "channel",
1485            Variant_::Offset => "offset",
1486            Variant_::Scale => "scale",
1487            Variant_::Arithmetic => "arithmetic",
1488            Variant_::UnaryArithmetic => "unaryArithmetic",
1489            Variant_::BinaryArithmetic => "binaryArithmetic",
1490            Variant_::Unknown(_) => "unknown variant",
1491        }
1492    }
1493}
1494impl<'de> de::Deserialize<'de> for Variant_ {
1495    fn deserialize<D>(d: D) -> Result<Variant_, D::Error>
1496    where
1497        D: de::Deserializer<'de>,
1498    {
1499        d.deserialize_str(VariantVisitor_)
1500    }
1501}
1502struct VariantVisitor_;
1503impl<'de> de::Visitor<'de> for VariantVisitor_ {
1504    type Value = Variant_;
1505    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1506        fmt.write_str("string")
1507    }
1508    fn visit_str<E>(self, value: &str) -> Result<Variant_, E>
1509    where
1510        E: de::Error,
1511    {
1512        let v = match value {
1513            "abs" => Variant_::Abs,
1514            "negate" => Variant_::Negate,
1515            "cos" => Variant_::Cos,
1516            "sin" => Variant_::Sin,
1517            "tan" => Variant_::Tan,
1518            "acos" => Variant_::Acos,
1519            "asin" => Variant_::Asin,
1520            "ln" => Variant_::Ln,
1521            "log10" => Variant_::Log10,
1522            "sqrt" => Variant_::Sqrt,
1523            "add" => Variant_::Add,
1524            "subtract" => Variant_::Subtract,
1525            "multiply" => Variant_::Multiply,
1526            "divide" => Variant_::Divide,
1527            "floorDivide" => Variant_::FloorDivide,
1528            "power" => Variant_::Power,
1529            "modulo" => Variant_::Modulo,
1530            "atan2" => Variant_::Atan2,
1531            "max" => Variant_::Max,
1532            "mean" => Variant_::Mean,
1533            "min" => Variant_::Min,
1534            "sum" => Variant_::Sum,
1535            "union" => Variant_::Union,
1536            "product" => Variant_::Product,
1537            "constant" => Variant_::Constant,
1538            "selectNewestPoints" => Variant_::SelectNewestPoints,
1539            "selectNumeric" => Variant_::SelectNumeric,
1540            "selectNumericProperty" => Variant_::SelectNumericProperty,
1541            "selectOldestPoints" => Variant_::SelectOldestPoints,
1542            "bitAnd" => Variant_::BitAnd,
1543            "bitOr" => Variant_::BitOr,
1544            "bitXor" => Variant_::BitXor,
1545            "bitShiftRight" => Variant_::BitShiftRight,
1546            "bitShiftLeft" => Variant_::BitShiftLeft,
1547            "bitTest" => Variant_::BitTest,
1548            "ifElse" => Variant_::IfElse,
1549            "numericAggregation" => Variant_::NumericAggregation,
1550            "countDuplicate" => Variant_::CountDuplicate,
1551            "cumulativeSum" => Variant_::CumulativeSum,
1552            "derivative" => Variant_::Derivative,
1553            "integral" => Variant_::Integral,
1554            "zScore" => Variant_::ZScore,
1555            "raw" => Variant_::Raw,
1556            "derived" => Variant_::Derived,
1557            "resample" => Variant_::Resample,
1558            "resampleV2" => Variant_::ResampleV2,
1559            "nthPointDownsample" => Variant_::NthPointDownsample,
1560            "largestTriangleThreeBuckets" => Variant_::LargestTriangleThreeBuckets,
1561            "signalFilter" => Variant_::SignalFilter,
1562            "timeDifference" => Variant_::TimeDifference,
1563            "absoluteTimestamp" => Variant_::AbsoluteTimestamp,
1564            "timeRangeFilter" => Variant_::TimeRangeFilter,
1565            "timeShift" => Variant_::TimeShift,
1566            "timeShiftV2" => Variant_::TimeShiftV2,
1567            "unitConversion" => Variant_::UnitConversion,
1568            "unitOverride" => Variant_::UnitOverride,
1569            "valueDifference" => Variant_::ValueDifference,
1570            "filterTransformation" => Variant_::FilterTransformation,
1571            "filterWhere" => Variant_::FilterWhere,
1572            "thresholdFilter" => Variant_::ThresholdFilter,
1573            "approximateFilter" => Variant_::ApproximateFilter,
1574            "dropNan" => Variant_::DropNan,
1575            "select1dArrayIndex" => Variant_::Select1dArrayIndex,
1576            "aggregateUnderRanges" => Variant_::AggregateUnderRanges,
1577            "rangeDuration" => Variant_::RangeDuration,
1578            "groupWithinRangesV2" => Variant_::GroupWithinRangesV2,
1579            "filterByExpression" => Variant_::FilterByExpression,
1580            "scalarUdf" => Variant_::ScalarUdf,
1581            "enumToNumeric" => Variant_::EnumToNumeric,
1582            "contains" => Variant_::Contains,
1583            "refprop" => Variant_::Refprop,
1584            "refpropV2" => Variant_::RefpropV2,
1585            "extractFromStruct" => Variant_::ExtractFromStruct,
1586            "tagByIntervals" => Variant_::TagByIntervals,
1587            "filterByTag" => Variant_::FilterByTag,
1588            "selectTags" => Variant_::SelectTags,
1589            "toStartOfInterval" => Variant_::ToStartOfInterval,
1590            "phaseUnwrap" => Variant_::PhaseUnwrap,
1591            "aggregate" => Variant_::Aggregate,
1592            "rollingOperation" => Variant_::RollingOperation,
1593            "bitOperation" => Variant_::BitOperation,
1594            "channel" => Variant_::Channel,
1595            "offset" => Variant_::Offset,
1596            "scale" => Variant_::Scale,
1597            "arithmetic" => Variant_::Arithmetic,
1598            "unaryArithmetic" => Variant_::UnaryArithmetic,
1599            "binaryArithmetic" => Variant_::BinaryArithmetic,
1600            value => Variant_::Unknown(value.to_string().into_boxed_str()),
1601        };
1602        Ok(v)
1603    }
1604}
1605///An unknown variant of the NumericSeries union.
1606#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1607pub struct Unknown {
1608    type_: Box<str>,
1609    value: conjure_object::Any,
1610}
1611impl Unknown {
1612    /// Returns the unknown variant's type name.
1613    #[inline]
1614    pub fn type_(&self) -> &str {
1615        &self.type_
1616    }
1617}