Struct arrow2::io::json::Reader[][src]

pub struct Reader<R: Read> { /* fields omitted */ }
Expand description

JSON Reader

This JSON reader allows JSON line-delimited files to be read into the Arrow memory model. Records are loaded in batches and are then converted from row-based data to columnar data.

Example:

use std::sync::Arc;
use arrow2::datatypes::{DataType, Field, Schema};
use arrow2::io::json;
use std::fs::File;
use std::io::BufReader;

let schema = Arc::new(Schema::new(vec![
    Field::new("a", DataType::Float64, false),
    Field::new("b", DataType::Float64, false),
    Field::new("c", DataType::Float64, false),
]));

let file = File::open("test/data/basic.json").unwrap();

let mut json = json::Reader::new(BufReader::new(file), schema, 1024, None);
let batch = json.next().unwrap().unwrap();

Implementations

Create a new JSON Reader from any value that implements the Read trait.

If reading a File, you can customise the Reader, such as to enable schema inference, use ReaderBuilder.

Create a new JSON Reader from a BufReader<R: Read>

To customize the schema, such as to enable schema inference, use ReaderBuilder

Returns the schema of the reader, useful for getting the schema without reading record batches

Read the next batch of records

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.