4paradigm / 4paradigm/OpenMLDB

ConstNode GetAsXXXX methods refactor

Aperta
#580 4 commenti 0 reazioni 1 assegnatario Rivendicata da @jingchen2222 Vedi su GitHub
enhancement
Lingua principale
C++
Stelle
1.7k
Fork
331
Merge medio
12g 12h
PR unite (30g)
1

Descrizione

**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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
backend
Tipo di issue
Refactoring
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.