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