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