-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Abdullahsab3 <[email protected]>
- Loading branch information
1 parent
6430151
commit d851959
Showing
13 changed files
with
966 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
|
||
let table = deltalake::open_table("../rust/tests/data/cdf-table").await?; | ||
let table = deltalake::open_table("tmp/some-table").await?; | ||
let ctx = SessionContext::new(); | ||
let ops = DeltaOps(table); | ||
let cdf = ops.load_cdf() | ||
let cdf = ops | ||
.load_cdf() | ||
.with_starting_version(0) | ||
.with_ending_version(4) | ||
.build() | ||
.await?; | ||
|
||
arrow_cast::pretty::print_batches(&cdf)?; | ||
let batches = collect_batches( | ||
cdf.properties().output_partitioning().partition_count(), | ||
&cdf, | ||
ctx, | ||
).await?; | ||
arrow_cast::pretty::print_batches(&batches)?; | ||
|
||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
async fn collect_batches( | ||
num_partitions: usize, | ||
stream: &impl ExecutionPlan, | ||
ctx: SessionContext, | ||
) -> Result<Vec<RecordBatch>, Box<dyn std::error::Error>> { | ||
let mut batches = vec![]; | ||
for p in 0..num_partitions { | ||
let data: Vec<RecordBatch> = | ||
collect_sendable_stream(stream.execute(p, ctx.task_ctx())?).await?; | ||
batches.extend_from_slice(&data); | ||
} | ||
Ok(batches) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.