Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Updated guide
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Feb 27, 2022
1 parent 44ddfdf commit 11f88b8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
6 changes: 4 additions & 2 deletions guide/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ interoperability with the arrow format.

The typical use-case for this library is to perform CPU and memory-intensive analytics in a format that supports heterogeneous data structures, null values, and IPC and FFI interfaces across languages.

Arrow2 is divided into three main parts:
Arrow2 is divided into 5 main parts:

* a [low-level API](./low_level.md) to efficiently operate with contiguous memory regions;
* a [high-level API](./high_level.md) to operate with arrow arrays;
* a [metadata API](./metadata.md) to declare and operate with logical types and metadata.
* a [metadata API](./metadata.md) to declare and operate with logical types and metadata;
* a [compute API](./compute.md) with operators to operate over arrays;
* an [IO API](./io/README.md) with interfaces to read from, and write to, other formats.
13 changes: 13 additions & 0 deletions guide/src/io/json_read.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,16 @@ This crate also supports reading JSON, at the expense of being unable to read th
```rust
{{#include ../../../examples/json_read.rs}}
```

## Metadata and inference

This crate uses the following mapping between Arrow's data type and JSON:

| `JSON` | `DataType` |
| ------ | ---------- |
| Bool | Boolean |
| Int | Int64 |
| Float | Float64 |
| String | Utf8 |
| List | List |
| Object | Struct |
10 changes: 8 additions & 2 deletions guide/src/io/json_write.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Write JSON

When compiled with feature `io_json`, you can use this crate to write JSON files.
The following example writes a batch as a JSON file:
When compiled with feature `io_json`, you can use this crate to write JSON.
The following example writes an array to JSON:

```rust
{{#include ../../../examples/json_write.rs}}
```

Likewise, you can also use it to write to NDJSON:

```rust
{{#include ../../../examples/ndjson_write.rs}}
```
3 changes: 1 addition & 2 deletions tests/it/io/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ fn write_batch(array: Box<dyn Array>) -> Result<Vec<u8>> {
let mut serializer = json_write::Serializer::new(vec![Ok(array)].into_iter(), vec![]);

let mut buf = vec![];
json_write::write(&mut buf, &mut serializer);

json_write::write(&mut buf, &mut serializer)?;
Ok(buf)
}

0 comments on commit 11f88b8

Please sign in to comment.