tustvold commented on code in PR #6606:
URL: https://github.com/apache/arrow-rs/pull/6606#discussion_r1808260914
##########
arrow-json/src/writer/encoder.rs:
##########
@@ -545,3 +555,37 @@ where
out.push(b'"');
}
}
+
+struct Decimal128Encoder<'a> {
+ array: &'a Decimal128Array,
+}
+
+impl<'a> Decimal128Encoder<'a> {
+ fn new(array: &'a Decimal128Array) -> Self {
+ Self { array }
+ }
+}
+
+impl<'a> Encoder for Decimal128Encoder<'a> {
+ fn encode(&mut self, idx: usize, out: &mut Vec<u8>) {
+ let formatted = self.array.value_as_string(idx);
Review Comment:
FWIW you can avoid this allocation by using
https://docs.rs/arrow-cast/latest/arrow_cast/display/struct.ArrayFormatter.html
--
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]