alamb commented on code in PR #8510:
URL: https://github.com/apache/arrow-datafusion/pull/8510#discussion_r1424637913


##########
datafusion/core/src/dataframe/mod.rs:
##########
@@ -1271,8 +1273,13 @@ impl DataFrame {
     /// ```
     pub async fn cache(self) -> Result<DataFrame> {
         let context = 
SessionContext::new_with_state(self.session_state.clone());
+        // type cast

Review Comment:
   Rather than explcilty running (only) coercion (which is also run as part of 
execution) I suggest you use the schema that comes directly from the output 
stream
   
   Something like (copied from `Self::collect`): 
https://docs.rs/datafusion/latest/src/datafusion/dataframe/mod.rs.html#756-760
   ```
           let task_ctx = Arc::new(self.task_ctx());
           let plan = self.create_physical_plan().await?;
           let schema = plan.schema();
           collect(plan, task_ctx).await
   ```
   



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