Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: add a diagram to docstring for DictionaryArray #1909

Merged
merged 6 commits into from Jun 21, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions arrow/src/array/array_dictionary.rs
Expand Up @@ -33,6 +33,31 @@ use crate::error::Result;
/// This is mostly used to represent strings or a limited set of primitive types as integers,
/// for example when doing NLP analysis or representing chromosomes by name.
///
/// [`DictionaryArray`] are represented using a `keys` array and a
/// `values` array, which may be different lengths. The `keys` array
/// stores indexes in the `values` array which holds
/// the corresponding logical value, as shown here:
///
/// ```text
/// ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
/// ┌─────────────────┐ ┌─────────┐ │ ┌─────────────────┐
///│ │ A │ │ 0 │ │ A │ values[keys[0]]
/// ├─────────────────┤ ├─────────┤ │ ├─────────────────┤
///│ │ D │ │ 2 │ │ B │ values[keys[1]]
/// ├─────────────────┤ ├─────────┤ │ ├─────────────────┤
///│ │ B │ │ 2 │ │ B │ values[keys[2]]
/// ├─────────────────┤ ├─────────┤ │ ├─────────────────┤
///│ │ C │ │ 1 │ │ D │ values[keys[3]]
/// ├─────────────────┤ └─────────┘ │ └─────────────────┘
///│ │ E │ keys
/// └─────────────────┘ │
///│ values Logical array
/// ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ Contents
///
/// DictionaryArray
/// length = 4
/// ```
///
/// Example **with nullable** data:
///
/// ```
Expand Down