kosiew commented on code in PR #17021: URL: https://github.com/apache/datafusion/pull/17021#discussion_r2284281614
########## datafusion-cli/src/cli_context.rs: ########## @@ -93,6 +156,128 @@ impl CliSessionContext for SessionContext { &self, plan: LogicalPlan, ) -> Result<DataFrame, DataFusionError> { - self.execute_logical_plan(plan).await + SessionContext::execute_logical_plan(self, plan).await + } +} + +/// Session context used by the CLI with memory profiling support. +pub struct ReplSessionContext { + ctx: SessionContext, + memory_profiling: AtomicBool, + base_memory_pool: Arc<dyn MemoryPool>, + tracked_memory_pool: RwLock<Option<Arc<dyn TrackedPool>>>, + top_memory_consumers: usize, +} + +impl ReplSessionContext { + pub fn new( + ctx: SessionContext, + base_memory_pool: Arc<dyn MemoryPool>, + top_memory_consumers: usize, + ) -> Self { + Self { + ctx, + memory_profiling: AtomicBool::new(false), + base_memory_pool, + tracked_memory_pool: RwLock::new(None), + top_memory_consumers, + } + } +} + +#[async_trait::async_trait] +impl CliSessionContext for ReplSessionContext { Review Comment: It is still required for casting SessionContext to dyn CliSessionContext. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org