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