fresh-borzoni commented on code in PR #175:
URL: https://github.com/apache/fluss-rust/pull/175#discussion_r2702318775


##########
crates/fluss/src/row/binary/binary_writer.rs:
##########
@@ -30,36 +30,48 @@ pub trait BinaryWriter {
     /// Set null to this field
     fn set_null_at(&mut self, pos: usize);
 
-    fn write_boolean(&mut self, value: bool);
+    fn write_boolean(&mut self, value: bool) -> Result<()>;
 
-    fn write_byte(&mut self, value: u8);
+    fn write_byte(&mut self, value: u8) -> Result<()>;
 
-    fn write_bytes(&mut self, value: &[u8]);
+    fn write_bytes(&mut self, value: &[u8]) -> Result<()>;
 
-    fn write_char(&mut self, value: &str, length: usize);
+    fn write_char(&mut self, value: &str, length: usize) -> Result<()>;
 
-    fn write_string(&mut self, value: &str);
+    fn write_string(&mut self, value: &str) -> Result<()>;
 
-    fn write_short(&mut self, value: i16);
+    fn write_short(&mut self, value: i16) -> Result<()>;
 
-    fn write_int(&mut self, value: i32);
+    fn write_int(&mut self, value: i32) -> Result<()>;
 
-    fn write_long(&mut self, value: i64);
+    fn write_long(&mut self, value: i64) -> Result<()>;
 
-    fn write_float(&mut self, value: f32);
+    fn write_float(&mut self, value: f32) -> Result<()>;
 
-    fn write_double(&mut self, value: f64);
+    fn write_double(&mut self, value: f64) -> Result<()>;
 
-    fn write_binary(&mut self, bytes: &[u8], length: usize);
+    fn write_binary(&mut self, bytes: &[u8], length: usize) -> Result<()>;
 
-    // TODO Decimal type
-    // fn write_decimal(&mut self, pos: i32, value: f64);
+    fn write_decimal(
+        &mut self,
+        value: &bigdecimal::BigDecimal,
+        precision: u32,
+        scale: u32,

Review Comment:
   Good question, thank you, it's because Java you construct Decimal first with 
explicit precision. 
   So rescaling is done when you construct Decimal, here we don't use wrapper, 
so we need to pass scale explicitly.
   
   It's correct, but I'm leaning to wrapper class now, so we can have 2 steps 
process as well, seems ergonomics is worth it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to