1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::prelude::*;
use arrow::array::{BooleanArray, PrimitiveArray, Utf8Array};
use std::sync::Arc;

impl<T: PolarsNumericType> From<(&str, PrimitiveArray<T::Native>)> for ChunkedArray<T> {
    fn from(tpl: (&str, PrimitiveArray<T::Native>)) -> Self {
        let name = tpl.0;
        let arr = tpl.1;

        ChunkedArray::from_chunks(name, vec![Arc::new(arr)])
    }
}

impl<T: PolarsNumericType> From<&[T::Native]> for ChunkedArray<T> {
    fn from(slice: &[T::Native]) -> Self {
        ChunkedArray::from_slice("", slice)
    }
}

impl From<(&str, BooleanArray)> for BooleanChunked {
    fn from(tpl: (&str, BooleanArray)) -> Self {
        let name = tpl.0;
        let arr = tpl.1;

        ChunkedArray::from_chunks(name, vec![Arc::new(arr)])
    }
}

impl From<BooleanArray> for BooleanChunked {
    fn from(arr: BooleanArray) -> Self {
        ChunkedArray::from_chunks("", vec![Arc::new(arr)])
    }
}

impl From<(&str, Utf8Array<i64>)> for Utf8Chunked {
    fn from(tpl: (&str, Utf8Array<i64>)) -> Self {
        let name = tpl.0;
        let arr = tpl.1;

        ChunkedArray::from_chunks(name, vec![Arc::new(arr)])
    }
}