Expand description
VariantValue: an owned, engine-neutral representation of SQL VARIANT.
- Structurally equivalent to the Parquet variant type.
- Straightforward mapping to both sqllib representations of the Feldera SQL VARIANT.
- Mutable: new attributes can be added without reencoding the entire binary value.
use std::collections::BTreeMap;
use feldera_types::variant::{VariantDecimal8, VariantValue};
let attributes = VariantValue::Object(BTreeMap::from([
("kafka_topic".to_string(), VariantValue::String("events".into())),
("kafka_offset".to_string(), VariantValue::Int64(17)),
("price".to_string(), VariantValue::Decimal8(VariantDecimal8::try_new(12345, 2)?)),
]));
let VariantValue::Object(fields) = &attributes else {
unreachable!()
};
assert_eq!(fields["kafka_offset"], VariantValue::Int64(17));Structs§
- Variant
Decimal4 - A decimal of at most 9 digits, the Parquet variant’s 4-byte decimal.
- Variant
Decimal8 - A decimal of at most 18 digits, the Parquet variant’s 8-byte decimal.
- Variant
Decimal16 - A decimal of at most 38 digits, the Parquet variant’s 16-byte decimal.
Enums§
- Variant
Decimal Error - Error creating a decimal value.
- Variant
Value - An owned
VARIANTvalue whose types mirror the Parquet variant encoding.