This is an automated email from the ASF dual-hosted git repository.
yuxia pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 29e0cdb chore: added Default Implementations for Missing Types (#326)
29e0cdb is described below
commit 29e0cdb2474251e338f18974255a8a7febd56d66
Author: Nikhil Negi <[email protected]>
AuthorDate: Mon Feb 16 06:14:27 2026 +0530
chore: added Default Implementations for Missing Types (#326)
---
crates/fluss/src/metadata/datatype.rs | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/crates/fluss/src/metadata/datatype.rs
b/crates/fluss/src/metadata/datatype.rs
index 3da270b..66f68f4 100644
--- a/crates/fluss/src/metadata/datatype.rs
+++ b/crates/fluss/src/metadata/datatype.rs
@@ -390,6 +390,12 @@ impl CharType {
}
}
+impl Default for CharType {
+ fn default() -> Self {
+ Self::new(1)
+ }
+}
+
impl Display for CharType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "CHAR({})", self.length)?;
@@ -503,6 +509,13 @@ impl DecimalType {
}
}
+impl Default for DecimalType {
+ fn default() -> Self {
+ Self::new(Self::DEFAULT_PRECISION, Self::DEFAULT_SCALE)
+ .expect("Invalid default decimal precision or scale")
+ }
+}
+
impl Display for DecimalType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "DECIMAL({}, {})", self.precision, self.scale)?;
@@ -548,13 +561,13 @@ impl Display for DateType {
}
}
-#[derive(Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
Serialize, Deserialize)]
+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize,
Deserialize)]
pub struct TimeType {
nullable: bool,
precision: u32,
}
-impl TimeType {
+impl Default for TimeType {
fn default() -> Self {
Self::new(Self::DEFAULT_PRECISION).expect("Invalid default time
precision")
}
@@ -798,6 +811,12 @@ impl BinaryType {
}
}
+impl Default for BinaryType {
+ fn default() -> Self {
+ Self::new(Self::DEFAULT_LENGTH)
+ }
+}
+
impl Display for BinaryType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "BINARY({})", self.length)?;