fn from_str()

in crates/paimon/src/spec/types.rs [724:751]


    fn from_str(s: &str) -> Result<Self, Self::Err> {
        if !s.starts_with(serde_utils::LocalZonedTimestamp::NAME) || !s.contains("WITH") {
            return DataTypeInvalidSnafu {
                message:
                    "Invalid LocalZonedTimestamp type. Expected string to start with 'TIMESTAMP'.",
            }
            .fail();
        }

        let (open_bracket, close_bracket) =
            serde_utils::extract_brackets_pos(s, "LocalZonedTimestampType")?;
        let precision_str = &s[open_bracket + 1..close_bracket];
        let precision =
            precision_str
                .trim()
                .parse::<u32>()
                .map_err(|_| Error::DataTypeInvalid {
                    message: "Invalid LocalZonedTimestamp length. Unable to parse length as a u32."
                        .to_string(),
                })?;

        let nullable = !s[close_bracket..].contains("NOT NULL");

        Ok(LocalZonedTimestampType {
            nullable,
            precision,
        })
    }