Struct polars::prelude::ArrowJsonReader[]

pub struct ArrowJsonReader<R> where
    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::io::{Cursor, BufReader};

let schema = Arc::new(Schema::new(vec![
    Field::new("a", DataType::Int64, true),
    Field::new("b", DataType::Float32, true),
    Field::new("c", DataType::Boolean, true),
    Field::new("d", DataType::Utf8, true),
]));

let data = r#"{"a":1, "b":2.0, "c":false, "d":"4"}
{"a":-10, "b":-3.5, "c":true, "d":null}
{"a":100000000, "b":0.6, "d":"text"}"#;
let mut reader = BufReader::new(Cursor::new(data));
let mut reader = json::Reader::new(&mut reader, schema, 1024, None);
let batch = reader.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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.