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