tustvold opened a new issue, #2659:
URL: https://github.com/apache/arrow-datafusion/issues/2659

   **Describe the bug**
   
   Currently `DataFrame` implements `TableProvider` allowing it to be 
registered on a `SessionContext`, this will often be the same `SessionContext` 
from which its `Arc<RwLock<SessionState>>` came. For example
   
   ```
   #[tokio::test]
       async fn register_table() -> Result<()> {
           let df = test_table().await?.select_columns(&["c1", "c12"])?;
           let ctx = SessionContext::new();
           let df_impl = Arc::new(DataFrame::new(ctx.state.clone(), 
&df.plan.clone()));
       
           // register a dataframe as a table
           ctx.register_table("test_table", df_impl.clone())?;
   ```
   
   This will result in a circular reference that will prevent destruction of 
the SchemaProvider and the DataFrame.
   
   **To Reproduce**
   
   Inspect code
   
   **Expected behavior**
   
   It should not be possible to introduce circular dependencies. On a more 
holistic level, I'm not entirely sure what the purpose of this API is. Perhaps 
it could be removed and replaced with a combination of 
`DataFrame::to_logical_plan` and `ViewTable` (once #2657 is fixed)
   
   **Additional context**
   
   https://github.com/apache/arrow-datafusion/issues/2658
   
   FYI @yjshen @xudong963 
   


-- 
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...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to