// Create pure RecordBatches without knowledge of Influx datatype
Create pure RecordBatches without knowledge of Influx datatype
Create pure RecordBatches without knowledge of Influx datatype
fn create_batches() -> Vec<Arc<RecordBatch>> {
        // Batch 1: <dict, i64, str, bool, time>  & 3 rows
        let dict_array: ArrayRef = Arc::new(
            vec![Some("a"), None, Some("b")]
                .into_iter()
                .collect::<DictionaryArray<Int32Type>>(),
        );
        let int64_array: ArrayRef =
            Arc::new([Some(-1), None, Some(2)].iter().collect::<Int64Array>());
        let string_array: ArrayRef = Arc::new(
            vec![Some("foo"), Some("and"), Some("bar")]
                .into_iter()
                .collect::<StringArray>(),
        );
        let bool_array: ArrayRef = Arc::new(
            [Some(true), None, Some(false)]
                .iter()
                .collect::<BooleanArray>(),
        );
        let ts_array: ArrayRef = Arc::new(
            [Some(150), Some(200), Some(1526823730000000000)]
                .iter()
                .collect::<TimestampNanosecondArray>(),
        );
        let batch1 = RecordBatch::try_from_iter_with_nullable(vec![
            ("dict", dict_array, true),
            ("int64", int64_array, true),
            ("string", string_array, true),
            ("bool", bool_array, true),
            ("time", ts_array, false), // not null
        ])
        .unwrap();
        // Batch 2: <dict, u64, f64, str, bool, time> & 2 rows
        let dict_array: ArrayRef = Arc::new(
            vec![None, Some("d")]
                .into_iter()
                .collect::<DictionaryArray<Int32Type>>(),
        );
        let uint64_array: ArrayRef = Arc::new([Some(1), Some(2)].iter().collect::<UInt64Array>()); // not null
        let float64_array: ArrayRef =
            Arc::new([Some(1.0), Some(2.0)].iter().collect::<Float64Array>());
        let string_array: ArrayRef = Arc::new(
            vec![Some("foo"), Some("bar")]
                .into_iter()
                .collect::<StringArray>(),
        );
        let bool_array: ArrayRef = Arc::new([Some(true), None].iter().collect::<BooleanArray>());
        let ts_array: ArrayRef = Arc::new(
            [Some(100), Some(1626823730000000000)] // not null
                .iter()
                .collect::<TimestampNanosecondArray>(),
        );
        let batch2 = RecordBatch::try_from_iter_with_nullable(vec![
            ("dict", dict_array, true),
            ("uint64", uint64_array, false), // not null
            ("float64", float64_array, true),
            ("string", string_array, true),
            ("bool", bool_array, true),
            ("time", ts_array, false), // not null
        ])
        .unwrap();
        vec![Arc::new(batch1), Arc::new(batch2)]
    }
fn create_batches ( ) -> Vec < Arc < RecordBatch > > { // Batch 1: <dict, i64, str, bool, time>  & 3 rows let dict_array : ArrayRef = Arc :: new ( vec ! [ Some ( " " ) None Some ( " " ) ] . into_iter ( ) . collect :: < DictionaryArray < Int32Type > > ( ) , ) ; let int64_array : ArrayRef = Arc :: new ( [ Some ( - 1 ) , None , Some ( 2 ) ] . iter ( ) . collect :: < Int64Array > ( ) ) ; let string_array : ArrayRef = Arc :: new ( vec ! [ Some ( " " ) Some ( " " ) Some ( " " ) ] . into_iter ( ) . collect :: < StringArray > ( ) , ) ; let bool_array : ArrayRef = Arc :: new ( [ Some ( true ) , None , Some ( false ) ] . iter ( ) . collect :: < BooleanArray > ( ) , ) ; let ts_array : ArrayRef = Arc :: new ( [ Some ( 150 ) , Some ( 200 ) , Some ( 1526823730000000000 ) ] . iter ( ) . collect :: < TimestampNanosecondArray > ( ) , ) ; let batch1 = RecordBatch :: try_from_iter_with_nullable ( vec ! [ ( " " dict_array true ) ( " " int64_array true ) ( " " string_array true ) ( " " bool_array true ) ( " " ts_array false ) // not null ] ) . unwrap ( ) ; // Batch 2: <dict, u64, f64, str, bool, time> & 2 rows let dict_array : ArrayRef = Arc :: new ( vec ! [ None Some ( " " ) ] . into_iter ( ) . collect :: < DictionaryArray < Int32Type > > ( ) , ) ; let uint64_array : ArrayRef = Arc :: new ( [ Some ( 1 ) , Some ( 2 ) ] . iter ( ) . collect :: < UInt64Array > ( ) ) ; // not null let float64_array : ArrayRef = Arc :: new ( [ Some ( 1.0 ) , Some ( 2.0 ) ] . iter ( ) . collect :: < Float64Array > ( ) ) ; let string_array : ArrayRef = Arc :: new ( vec ! [ Some ( " " ) Some ( " " ) ] . into_iter ( ) . collect :: < StringArray > ( ) , ) ; let bool_array : ArrayRef = Arc :: new ( [ Some ( true ) , None ] . iter ( ) . collect :: < BooleanArray > ( ) ) ; let ts_array : ArrayRef = Arc :: new ( [ Some ( 100 ) , Some ( 1626823730000000000 ) ] // not null . iter ( ) . collect :: < TimestampNanosecondArray > ( ) , ) ; let batch2 = RecordBatch :: try_from_iter_with_nullable ( vec ! [ ( " " dict_array true ) ( " " uint64_array false ) // not null ( " " float64_array true ) ( " " string_array true ) ( " " bool_array true ) ( " " ts_array false ) // not null ] ) . unwrap ( ) ; vec ! [ Arc new ( batch1 ) Arc new ( batch2 ) ] }
Create pure RecordBatches without knowledge of Influx datatype
Create pure RecordBatches without knowledge of Influx datatype