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

Dose it support datetime64? #178

Open
doowonee opened this issue Jul 24, 2022 · 3 comments
Open

Dose it support datetime64? #178

doowonee opened this issue Jul 24, 2022 · 3 comments

Comments

@doowonee
Copy link

I use the latest version which is 1.0.0-alpha.1 cause tokio 1.x

Here is the code to use DateTime64

        block
            .push(row! {
                time_col: DateTime64(row_data.event_at.timestamp_millis(), (3, UTC))
..........
            })

But It crashed like below

thread 'main' panicked at 'not implemented', /home/doowonee/.cargo/registry/src/github.com-1ecc6299db9ec823/clickhouse-rs-1.0.0-alpha.1/src/types/column/datetime64.rs:53:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::panicking::panic
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:48:5
   3: <clickhouse_rs::types::column::datetime64::DateTime64ColumnData as clickhouse_rs::types::column::column_data::ColumnData>::save
             at /home/doowonee/.cargo/registry/src/github.com-1ecc6299db9ec823/clickhouse-rs-1.0.0-alpha.1/src/types/column/datetime64.rs:53:9
   4: <clickhouse_rs::types::column::chunk::ChunkColumnData as clickhouse_rs::types::column::column_data::ColumnData>::save
             at /home/doowonee/.cargo/registry/src/github.com-1ecc6299db9ec823/clickhouse-rs-1.0.0-alpha.1/src/types/column/chunk.rs:30:9
   5: clickhouse_rs::types::column::Column<K>::write
             at /home/doowonee/.cargo/registry/src/github.com-1ecc6299db9ec823/clickhouse-rs-1.0.0-alpha.1/src/types/column/mod.rs:223:9
   6: clickhouse_rs::types::block::Block<K>::write
             at /home/doowonee/.cargo/registry/src/github.com-1ecc6299db9ec823/clickhouse-rs-1.0.0-alpha.1/src/types/block/mod.rs:365:17
   7: clickhouse_rs::types::block::Block<K>::send_data

And I see the source code and It was not implemented yet

impl ColumnData for DateTime64ColumnData {
    fn sql_type(&self) -> SqlType {
        let (precision, tz) = self.params;
        SqlType::DateTime(DateTimeType::DateTime64(precision, tz))
    }

    fn save(&self, _encoder: &mut Encoder, _start: usize, _end: usize) {
        unimplemented!()
    }

Am I using wrong?

@caibirdme
Copy link

same issue

@mplanchard
Copy link

anybody figure this out? I can't figure out how to insert a DateTime64 column

@suharev7
Copy link
Owner

suharev7 commented Oct 27, 2023

You can see examples of how to insert DateTime64 into tests. For example, here or here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants