leekeiabstraction commented on code in PR #138:
URL: https://github.com/apache/fluss-rust/pull/138#discussion_r2679302670
##########
crates/fluss/src/row/compacted/compacted_row.rs:
##########
@@ -24,125 +24,100 @@ use crate::row::{GenericRow, InternalRow};
// Reference implementation:
//
https://github.com/apache/fluss/blob/main/fluss-common/src/main/java/org/apache/fluss/row/compacted/CompactedRow.java
#[allow(dead_code)]
-pub struct CompactedRow {
+pub struct CompactedRow<'a> {
arity: usize,
- segment: Bytes,
+ segment: &'a [u8],
offset: usize,
size_in_bytes: usize,
- decoded: bool,
- decoded_row: GenericRow<'static>,
- reader: CompactedRowReader,
- deserializer: CompactedRowDeserializer,
+ decoded_row: OnceLock<GenericRow<'a>>,
+ deserializer: CompactedRowDeserializer<'a>,
+ reader: CompactedRowReader<'a>,
}
#[allow(dead_code)]
-impl CompactedRow {
+impl<'a> CompactedRow<'a> {
pub fn calculate_bit_set_width_in_bytes(arity: usize) -> usize {
arity.div_ceil(8)
}
- pub fn new(types: Vec<DataType>) -> Self {
- let arity = types.len();
- Self {
- arity,
- segment: Bytes::new(),
- offset: 0,
- size_in_bytes: 0,
- decoded: false,
- decoded_row: GenericRow::new(),
- reader: CompactedRowReader::new(arity),
- deserializer: CompactedRowDeserializer::new(types),
- }
- }
-
- pub fn from_bytes(types: Vec<DataType>, data: Bytes) -> Self {
+ pub fn from_bytes(types: &'a [DataType], data: &'a [u8]) -> Self {
let arity = types.len();
let size = data.len();
Self {
arity,
segment: data,
offset: 0,
Review Comment:
Offset doesn't seem to be used
##########
crates/fluss/src/row/compacted/compacted_row_reader.rs:
##########
@@ -151,7 +140,7 @@ impl CompactedRowReader {
panic!("Invalid input stream.");
Review Comment:
Is it right to panic here? What if most sig bytes of the i32 is non zero?
##########
crates/fluss/src/row/compacted/compacted_row_reader.rs:
##########
@@ -167,55 +156,58 @@ impl CompactedRowReader {
panic!("Invalid input stream.");
Review Comment:
Same q here
--
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]