luoyuxia commented on code in PR #230:
URL: https://github.com/apache/fluss-rust/pull/230#discussion_r2758925578
##########
bindings/cpp/src/lib.rs:
##########
@@ -517,41 +543,101 @@ impl Table {
}
fn new_log_scanner(&self) -> Result<*mut LogScanner, String> {
- let fluss_table = fcore::client::FlussTable::new(
- &self.connection,
- self.metadata.clone(),
- self.table_info.clone(),
- );
+ RUNTIME.block_on(async {
+ let fluss_table = fcore::client::FlussTable::new(
+ &self.connection,
+ self.metadata.clone(),
+ self.table_info.clone(),
+ );
+
+ let scanner = match fluss_table.new_scan().create_log_scanner() {
+ Ok(a) => a,
+ Err(e) => return Err(format!("Failed to create log scanner:
{e}")),
+ };
+
+ let scanner_ptr = Box::into_raw(Box::new(LogScanner {
+ inner: Some(scanner),
+ inner_batch: None,
+ }));
- let scanner = match fluss_table.new_scan().create_log_scanner() {
- Ok(a) => a,
- Err(e) => return Err(format!("Failed to create log scanner: {e}")),
- };
- let scanner = Box::into_raw(Box::new(LogScanner { inner: scanner }));
- Ok(scanner)
+ Ok(scanner_ptr)
+ })
Review Comment:
we'll still need the wrapper since `new_with_fetcher` will spawn tokio task.
If remove this, I'll encounter no tokio runtime issue.
--
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]