fresh-borzoni commented on code in PR #578:
URL: https://github.com/apache/fluss-rust/pull/578#discussion_r3336336802
##########
crates/fluss/src/record/arrow.rs:
##########
@@ -1667,52 +1668,33 @@ impl Iterator for ArrowLogRecordIterator {
}
pub struct ArrowReader {
- record_batch: Arc<RecordBatch>,
- row_type: Arc<RowType>,
- fluss_row_type: Option<Arc<RowType>>,
- row_column_indices: Arc<[usize]>,
+ batch: Arc<TypedBatch>,
}
impl ArrowReader {
pub fn new(record_batch: Arc<RecordBatch>, row_type: Arc<RowType>) -> Self
{
- let row_column_indices = arrow_row_column_indices(&record_batch);
- ArrowReader {
- record_batch,
- row_type,
- fluss_row_type: None,
- row_column_indices,
- }
+ Self::new_with_fluss_row_type(record_batch, row_type, None)
}
pub fn new_with_fluss_row_type(
record_batch: Arc<RecordBatch>,
row_type: Arc<RowType>,
fluss_row_type: Option<Arc<RowType>>,
) -> Self {
- let row_column_indices = match &fluss_row_type {
- Some(rt) => fluss_row_column_indices(rt),
- None => arrow_row_column_indices(&record_batch),
- };
+ let schema = fluss_row_type.as_deref().unwrap_or(&row_type);
+ let typed = TypedBatch::build(&record_batch, schema)
Review Comment:
Yeah, agreed - it shouldn't panic on a bad batch off the wire, fixed
--
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]