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

Vec<u32> serialization? #338

Open
CGenie opened this issue Jun 12, 2024 · 0 comments
Open

Vec<u32> serialization? #338

CGenie opened this issue Jun 12, 2024 · 0 comments

Comments

@CGenie
Copy link

CGenie commented Jun 12, 2024

Hello,

Currently i wrap Vec<u32> as MyVec and implement something like this:

impl duckdb::ToSql for MyVec<u32> {
    #[inline]
    fn to_sql(&self) -> duckdb::Result<duckdb::types::ToSqlOutput<'_>> {
        Ok(duckdb::types::ToSqlOutput::from(format!("{:?}", self.0)))
    }
}

I think however that such crude string formatting is highly inefficient. There is support for UInt(u32) (https://duckdb.org/docs/sql/data_types/overview.html, https://docs.rs/duckdb/latest/duckdb/types/enum.Value.html#variant.UInt) however I'm not sure why there is only Blob(u8) (https://docs.rs/duckdb/latest/duckdb/types/enum.Value.html#variant.Blob). DuckDB says ARRAY supports arbitrary types underneath (https://duckdb.org/docs/sql/data_types/array).

Or should I use List instead (https://docs.rs/duckdb/latest/duckdb/types/enum.Value.html#variant.List) ?

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

1 participant