ClickHouse / ClickHouse/clickhouse-cpp

Can't cast from Nullable(UInt64)

Ouverte
#368 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
C
Étoiles
382
Forks
209
Merge moyen
2 j 19 h
PR mergées (30 j)
14

Description

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!

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp
Domaine
databases
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.