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