Skip to content
Discussion options

You must be logged in to vote

Yes. You could try this to read https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/tests/example.csv with schema

use arrow::datatypes::{ Field, Schema, DataType};

use datafusion::error::Result;
use datafusion::prelude::*;
use datafusion::arrow::util::pretty;

#[tokio::main]
async fn main() -> Result<()> {
    let ctx = SessionContext::new();
    let schema = generate_schema();

    // register csv file with the execution context
    ctx.register_csv(
        "example",
        "/home/remziy/learning/datafusion/datafusion/core/tests/example.csv",
        CsvReadOptions::new().has_header(true).schema(&schema),
    )
    .await?;

    // execute the query
    let df = ct…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jefffrey
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