Skip to content

Nested field within a Map doesnt properly derive #62

@spotnate

Description

@spotnate

Thanks in advance. I've been experimenting and come across an issue in deriving a map field with a nested value. Here is a contrived example

#[derive(Serialize, Deserialize, Row)]
pub struct Foo {
    pub organization: String
    pub employees: HashMap<String, Vec<Person>>,
}

pub struct Person {
    pub name: String
    pub date: DateTime64<3>
}

Although this is possible in clickhouse with

CREATE TABLE hello
(
    organization String,
    employees Map(
        LowCardinality(String), 
        Nested(
            name String,
            date DateTime64(3)
        )
    ) 
)
ENGINE = MergeTree
ORDER BY organization

For reference, derive gives the following error:

the trait bound `Person: klickhouse::FromSql` is not satisfied
the following other types implement trait `klickhouse::FromSql`:
... noise ...
required for `Vec<Person>` to implement `klickhouse::FromSql`

I've also tried to use #[klickhouse(nested)] which did not work properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions