Can't cast from Nullable(UInt64)
Sembl4 opened this issue · 1 comments
Sembl4 commented
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!