Jefffrey commented on issue #1279:
URL: 
https://github.com/apache/arrow-datafusion/issues/1279#issuecomment-1316660929

   I tried to take an initial shot at this: 
https://github.com/Jefffrey/arrow-datafusion/commit/4761d169af2f08764af81f56aa1dab128a960167
   
   But have run into a roadblock, where in the `exec_and_print()` function it 
can potentially block whilst printing, especially for a very large result set.
   
   ```rust
   async fn exec_and_print(
       ctx: &mut SessionContext,
       print_options: &PrintOptions,
       sql: String,
   ) -> Result<()> {
       let now = Instant::now();
       let df = ctx.sql(&sql).await?;
       let results = df.collect().await?;
       print_options.print_batches(&results, now)?; // can block here!
   
       Ok(())
   }
   ```
   
   Since it is blocking, you can't abort the async function whilst it executes. 
Even spawning it in a separate task with `spawn_blocking()` doesn't look like 
it'll help, as though it would return control to let you enter more commands 
when you interrupt with CTRL-C, eventually that synchronous blocking print 
function will complete anyway and print onto the console (even though you 
interrupted it).
   
   Perhaps could spawn it in a separate thread and kill it, rather than trying 
to relying on async cancellation?


-- 
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]

Reply via email to