Skip to content

Can't cast from Nullable(UInt64) #368

Open
@Sembl4

Description

@Sembl4

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-infoAwaiting extra info from community/issue creator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions