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