Skip to content

Rust: RecordBatches to Dataframe after Collect #8158

Closed Answered by jonahgao
Cambyst asked this question in Q&A
Discussion options

You must be logged in to vote

Is it possible to handle it by cloning the DataFrame:

async fn test() {
    let df = test_table()
            .await?
            .select_columns(&["c2", "c3"])?
            .cache() // optionally cache the results as a memory table
            .await?;

        // clone and collect the results
        let results = df.clone().collect().await?;
        pretty::print_batches(&results)?;

        // processing later
        let df = df.filter(col("c2").eq(lit(3)))?;
        df.show().await?;
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by alamb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants