ClickHouse / ClickHouse/clickhouse-cpp
Can't cast from Nullable(UInt64)
- Lingua principale
- C
- Stelle
- 382
- Fork
- 209
- Merge medio
- 1g 22h
- PR unite (30g)
- 13
Descrizione
Hello, everyone!
I try to get a value from Nullable(UInt64) column, and I want to get std::optional as a result, with this code:
```
block[col]->AsStrict>()->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()->IsNull(row)){
std::cout << block[b_p_b]->AsStrict()->GetItem(row).get() << std::endl;
}
```
But this way is not very good for me, it would be much better if I could get std::optional as a result of this operation.
Please tell me how can I do this?
Thanks in advance!
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start by examining the AsStrict> expression and compare it with the working ColumnNullable IsNull and GetItem calls shown in the issue. Check the nullable column and casting APIs to determine whether std::optional is supported; done means the requested access path works or its supported limitation is clearly documented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- databases
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100