ClickHouse / ClickHouse/clickhouse-cpp

Can't cast from Nullable(UInt64)

Offen
#368 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
C
Sterne
382
Forks
209
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
13

Beschreibung

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!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.