4paradigm / 4paradigm/OpenMLDB

ConstNode GetAsXXXX methods refactor

Abierto
#580 4 comentarios 0 reacciones 1 asignado Reclamado por @jingchen2222 Ver en GitHub
enhancement
Lenguaje dominante
C++
Estrellas
1.7k
Forks
331
Merge medio
12 d 12 h
PR fusionados (30 d)
1

Descripción

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

This issue is going to to Refactor ConstNode's GetAsXXXX methods, e.g. `GetAsString()`, `GetAsDouble` etc, since it is hard to know if these GetAsXXXX methods go well or not. So we have to re-design the methods as follows:
```
bool GetAsInt(int* output);
bool GetAsString(std::string* str)
```

Also, we will support GetAsString for types like `kBool`, `kDate`, `kTimestamp`.
1. kBool: `true` -> `"true"`, kBool: `false` -> `"false"`
2. kTimestamp: `1590115420000` -> `"1590115420000L"`
3. kDate:
```
Date date(2020, 05, 22);
to_string(date.date_)
```
need to discuss what `kDate` string looks like. `yyyy-mm-dd` pattern string will be far more reasonable.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Look for ConstNode class in the codebase, likely in a header file. Examine existing GetAsXXXX methods to understand their signatures and usage. The refactor changes return types to bool and uses output parameters. Also need to implement GetAsString for kBool, kDate, kTimestamp types, deciding on string format for kDate. Check for any existing tests for ConstNode to update.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
backend
Tipo de issue
Refactorización
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.