suharev7 / clickhouse-rs

Asynchronous ClickHouse client library for Rust programming language.
MIT License
324 stars 121 forks source link

Vec<chrono::DateTime<Tz>> is not implemented for `clickhouse_rs::types::Value` #210

Open 1990heidou opened 11 months ago

1990heidou commented 11 months ago

The row! macro does not work properly when the field is Array(DateTime64),or maybe I am using it incorrectly.

fn push_to_block1(block: &mut Block) -> Result<(), Box<dyn Error>> {
    let mut events_t: Vec<DateTime<Tz>> = vec![];
    for _ in 0..3 {
        events_t.push(UTC.with_ymd_and_hms(2014, 7, 8, 14, 0, 0).unwrap());
    }
    block.push(row! {
         "Events.Timestamp" => events_t,
     });
    Ok(())
}

fn push_to_block2(block: &mut Block) -> Result<(), Box<dyn Error>> {
    let mut events_t: Vec<DateTime<Tz>> = vec![];
    for _ in 0..3 {
        events_t.push(UTC.with_ymd_and_hms(2014, 7, 8, 14, 0, 0).unwrap());
    }
    block.column("Events.Timestamp", vec![events_t]);
    Ok(())
}

image