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

Can't cast from Nullable(UInt64) #368

Open
Sembl4 opened this issue Apr 18, 2024 · 1 comment
Open

Can't cast from Nullable(UInt64) #368

Sembl4 opened this issue Apr 18, 2024 · 1 comment
Labels
need-info Awaiting extra info from community/issue creator

Comments

@Sembl4
Copy link

Sembl4 commented Apr 18, 2024

Hello, everyone!
I try to get a value from Nullable(UInt64) column, and I want to get std::optional<uint64_t> as a result, with this code:

block[col]->AsStrict<AsStrict<ColumnNullableT<ColumnUInt64>>()->At(row);

But I have an exception:

terminate called after throwing an instance of 'clickhouse::ValidationError'
what():  Can't cast from Nullable(UInt64)

I can get a value only this way, and this code works good:

if(!block[b_p_b]->AsStrict<ColumnNullable>()->IsNull(row)){
   std::cout << block[b_p_b]->AsStrict<ColumnNullable>()->GetItem(row).get<uint64_t>() << std::endl;
}

But this way is not very good for me, it would be much better if I could get std::optional<uint64_t> as a result of this operation.
Please tell me how can I do this?
Thanks in advance!

@Enmk
Copy link
Collaborator

Enmk commented Apr 18, 2024

Hi @Sembl4, thank you for a report!

Could you please specify library version and minimal viable example that against which you are able to reproduce the issue?

@Enmk Enmk added the need-info Awaiting extra info from community/issue creator label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-info Awaiting extra info from community/issue creator
Projects
None yet
Development

No branches or pull requests

2 participants