milenkovicm commented on code in PR #1993:
URL: 
https://github.com/apache/datafusion-ballista/pull/1993#discussion_r3734935689


##########
ballista/client/src/extension.rs:
##########
@@ -234,3 +237,46 @@ impl Extension {
         Ok(scheduler_url)
     }
 }
+
+/// Providing [DataFrameExt] for an extended functionality on DataFusion 
DataFrame.
+///
+#[async_trait::async_trait]
+pub trait DataFrameExt {
+    /// Checkpointing DataFrame - storing intermediate result to disk and 
breaking lineage in the plan
+    async fn checkpoint(self) -> datafusion::error::Result<DataFrame>;
+}
+
+#[async_trait::async_trait]
+impl DataFrameExt for DataFrame {
+    async fn checkpoint(self) -> datafusion::error::Result<DataFrame> {
+        let (state, plan) = self.into_parts();
+        let ctx = SessionContext::new_with_state(state);
+
+        let base_dir =
+            ctx.state()
+                .config()
+                .ballista_checkpoint_dir()
+                .ok_or_else(|| {
+                    DataFusionError::Configuration(
+                    "ballista.checkpoint.dir must be set to use 
DataFrame::checkpoint()"
+                        .to_string(),
+                )
+                })?;
+
+        let path = format!(
+            "{}/{}/{}",
+            base_dir.trim_end_matches('/'),
+            ctx.state().session_id(),
+            Uuid::new_v4()
+        );
+
+        // Executes the original plan as a normal distributed job.
+        ctx.execute_logical_plan(plan)

Review Comment:
   this is one way to implement this, but difference from spark that ballista 
checkpoint will materialize the dag (up to that point) instead of waiting 
standard actions, such as write. 
   
   this will work for first version, but maybe we should consider adding new 
logical plan extension which would represent checkpoint, wait for write op and 
then split plan on scheduler side using planner. 
   
   
   wdyt @sandugood 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to