in crates/paimon/src/spec/types.rs [959:984]
fn from_str(s: &str) -> Result<Self, Self::Err> {
if !s.starts_with(serde_utils::TIMESTAMP::NAME) {
return DataTypeInvalidSnafu {
message: "Invalid TIMESTAMP type. Expected string to start with 'TIMESTAMP'.",
}
.fail();
}
let (open_bracket, close_bracket) = serde_utils::extract_brackets_pos(s, "TimestampType")?;
let precision_str = &s[open_bracket + 1..close_bracket];
let precision =
precision_str
.trim()
.parse::<u32>()
.map_err(|_| Error::DataTypeInvalid {
message: "Invalid TIMESTAMP precision. Unable to parse precision as a u32."
.to_string(),
})?;
let nullable = !s[close_bracket..].contains("NOT NULL");
Ok(TimestampType {
nullable,
precision,
})
}