sandugood commented on code in PR #1993:
URL:
https://github.com/apache/datafusion-ballista/pull/1993#discussion_r3735341567
##########
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:
I chose the path of introducing `BallistaCheckpointNode` (alongside the
`BallistaCacheNode`), and also adding lazy materialization (to mirror Spark's
functionality)
--
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]