ClickHouse / ClickHouse/clickhouse-cpp
Can't cast from Nullable(UInt64)
- Lenguaje dominante
- C
- Estrellas
- 382
- Forks
- 209
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 14
Descripción
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!
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- databases
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100