// attempt to convert the encoded duration back to a WindowDuration
attempt to convert the encoded duration back to a WindowDuration
attempt to convert the encoded duration back to a WindowDuration
fn try_from(value: EncodedWindowDuration) -> Result<Self, Self::Error> {
        let EncodedWindowDuration { ty, field1, field2 } = value;
        match ty {
            ScalarValue::Utf8(Some(val)) if val == "variable" => {
                let months = if let ScalarValue::Int64(Some(v)) = field1 {
                    v
                } else {
                    return Err(DataFusionError::Internal(
                        format!("Invalid variable WindowDuration encoding. Expected int64 for months but got '{:?}'", field1)
                    ))
                };
                let negative = if let ScalarValue::Boolean(Some(v)) = field2 {
                    v
                } else {
                    return Err(DataFusionError::Internal(
                        format!("Invalid variable WindowDuration encoding. Expected bool for negative but got '{:?}'", field2)
                    ))
                };
                Ok(Self::Variable { months, negative })
            },
            ScalarValue::Utf8(Some(val)) if val == "fixed" => {
                let nanoseconds = if let ScalarValue::Int64(Some(v)) = field1 {
                    v
                } else {
                    return Err(DataFusionError::Internal(
                        format!("Invalid fixed WindowDuration encoding. Expected int64 for nanoseconds but got '{:?}'", field1)
                    ))
                };
                if let ScalarValue::Boolean(None) = field2 {
                } else {
                    return Err(DataFusionError::Internal(
                        format!("Invalid fixed WindowDuration encoding. Expected Null bool in field2 but got '{:?}'", field2)
                    ))
                };
                Ok(Self::Fixed { nanoseconds })
            }
            _ => return Err(DataFusionError::Internal(
                format!("Invalid WindowDuration encoding. Expected string 'variable' or 'fixed' but got '{:?}'", ty)
            ))
        }
    }
fn try_from ( value : EncodedWindowDuration ) -> Result < Self , Self :: Error > { let EncodedWindowDuration { ty , field1 , field2 } = value ; match ty { ScalarValue :: Utf8 ( Some ( val ) ) if val == " " => { let months = if let ScalarValue :: Int64 ( Some ( v ) ) = field1 { v } else { return Err ( DataFusionError :: Internal ( format ! ( " " field1 ) ) ) } ; let negative = if let ScalarValue :: Boolean ( Some ( v ) ) = field2 { v } else { return Err ( DataFusionError :: Internal ( format ! ( " " field2 ) ) ) } ; Ok ( Self :: Variable { months , negative } ) } , ScalarValue :: Utf8 ( Some ( val ) ) if val == " " => { let nanoseconds = if let ScalarValue :: Int64 ( Some ( v ) ) = field1 { v } else { return Err ( DataFusionError :: Internal ( format ! ( " " field1 ) ) ) } ; if let ScalarValue :: Boolean ( None ) = field2 { } else { return Err ( DataFusionError :: Internal ( format ! ( " " field2 ) ) ) } ; Ok ( Self :: Fixed { nanoseconds } ) } _ => return Err ( DataFusionError :: Internal ( format ! ( " " ty ) ) ) } }
attempt to convert the encoded duration back to a WindowDuration
attempt to convert the encoded duration back to a WindowDuration
value
EncodedWindowDuration