Keep the whole text when a non-string value is concatenated with a string (`+`, `CONCAT`)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
No file is named, so start where + and CONCAT are translated into PostgreSQL SQL and where the width of a string result is derived from its operands' classes (NUMERIC[p,s], DOUBLE, COLOR, INTERVAL); that width computation is what truncates the text. Reproduce with the lsf script from the report posted to /eval and compare against the table of failing expressions. Done means all listed cases return the full text, an unrepresentable value such as the GROUP SUM case raises an error instead of being cut, and a regression test covers the cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
On PostgreSQL, + and CONCAT can silently discard the end of their result when an operand is not a string. For the bounded results shown here, NUMERIC[p,s] contributes p characters to the width of the result, DOUBLE contributes 20, and COLOR and INTERVAL contribute 8 each. With a literal separator, CONCAT also counts its width between the operands. A decimal point or a minus sign can take a numeric value beyond its share of the width, and a DOUBLE can take more than 20 characters. When the combined text exceeds the width of the result, the excess is cut without an error or a warning. The lost characters can belong to the value or to the text that follows it, and a chain of + can lose them at an intermediate step.
This self-contained script is sent to /eval:
price = DATA LOCAL NUMERIC[5,2] ();
run() {
price() <- 123.45;
EXPORT FROM
rate = 'rate: ' + 1.5,
price = 'price: ' + price(),
negative = 'negative: ' + (-price()),
line = (CONCAT ' | ', price(), price(), 'end'),
explicit = 'price: ' + STRING(price());
}
Response (7.0-SNAPSHOT master and 6.3-SNAPSHOT, PostgreSQL 18):
{"rate":"rate: 1.","price":"price: 123.4","negative":"negative: -123.","line":"123.45 | 123.45 | e","explicit":"price: 123.45"}
Expected: rate: 1.5, price: 123.45, negative: -123.45, 123.45 | 123.45 | end.
More results of the same kind:
| Expression | Result | Expected |
|---|---|---|
'r=' + 0.25 |
r=0.2 |
r=0.25 |
'r=' + (-0.25) |
r=-0. |
r=-0.25 |
1.5 + ' end' |
1.5 en |
1.5 end |
'sum=' + (GROUP SUM price(i)), the class of the sum is NUMERIC[5,2], the total is 1234.50 |
sum=1234. |
sum=1234.50 |
'd=' + value() + '!', value is a DOUBLE property holding 1.2345678901234568e-05 |
d=1.2345678901234568e-! |
d=1.2345678901234568e-05! |
'c=' + RGB(0, 0, 0) + '!' |
c=-1677721! |
c=-16777216! |
'i=' + interval(2026_01_05, 2026_01_10) + '!' |
i=17675712! |
i=1767571200000.1768003200000! |
MESSAGE shows the cut text: MESSAGE CONCAT '|', price(), price(), price(), price(), 'end'; shows 123.45|123.45|123.45|123.45, with no sign that |end is missing.
A wider string operand leaves room for the value: STRING[10]('r=') + 0.25 is r=0.25. In the probes 'price: ' + STRING(price()), a CONCAT with a TEXT operand and 'price: ${price()}' kept the whole value. Converting a result that is already cut to STRING or TEXT does not bring its end back.
Reason
The value in the result is wrong, not just shorter: 123.4 and -123. are valid numbers, so nothing tells the reader that a digit is missing, and in a CONCAT of several values the lost end reads as "there was nothing more". In the reported case, the last lines of a diagnostic message disappeared.
Fix
Preserve the complete text of numbers and of the other non-string values, the separators and the surrounding text. If a value that does not fit its class (the GROUP SUM case) cannot be represented, report an error instead of returning a part of it.
- Lingua principale
- Java
- Stelle
- 214
- Fork
- 46
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lsfusion/platform
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
-
bug
Difficoltà 4/5 1-2 giorni Idoneità per principianti 58/100
Tutte le issue di lsfusion/platform
Issue simili
-
account assessment course feature lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
app:learninggoalhub enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyForse già presa @vaibhavgupta443 l’ha presa oggi. Apertagood first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apache/wicket#1991 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100