alamb commented on a change in pull request #1849:
URL: https://github.com/apache/arrow-datafusion/pull/1849#discussion_r816814703
##########
File path: datafusion/src/row/reader.rs
##########
@@ -44,6 +54,33 @@ pub fn read_as_batch(
output.output().map_err(DataFusionError::ArrowError)
}
+/// Read `data` of raw-bytes rows starting at `offsets` out to a record batch
+#[cfg(feature = "jit")]
+pub fn read_as_batch_jit(
+ data: &[u8],
+ schema: Arc<Schema>,
+ offsets: Vec<usize>,
+ assembler: &Assembler,
+) -> Result<RecordBatch> {
+ let row_num = offsets.len();
+ let mut output = MutableRecordBatch::new(row_num, schema.clone());
+ let mut row = RowReader::new(&schema, data);
+ register_read_functions(assembler)?;
+ let gen_func = gen_read_row(&schema, assembler)?;
+ let mut jit = assembler.create_jit();
+ let code_ptr = jit.compile(gen_func)?;
+ let code_fn = unsafe {
+ std::mem::transmute::<_, fn(&RowReader, &mut
MutableRecordBatch)>(code_ptr)
+ };
Review comment:
over time it would be good to try and encapsulate the unsafe code into a
smaller number of places (e.g. perhaps have an interface that creates a row
comparator)
--
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]