ROUND doesn't need to be a reserved word.
Because ROUND is a reserved word yet is NOT on the list of approved functions, it fails to get parsed. Simply dropping it from the list of reserved words makes it succeed in the HQL query parser. See #2964 Original Pull Request: #2966
This commit is contained in:
@@ -977,7 +977,6 @@ RANGE : R A N G E;
|
||||
RESPECT : R E S P E C T;
|
||||
RIGHT : R I G H T;
|
||||
ROLLUP : R O L L U P;
|
||||
ROUND : R O U N D;
|
||||
ROW : R O W;
|
||||
ROWS : R O W S;
|
||||
SEARCH : S E A R C H;
|
||||
|
||||
@@ -1448,13 +1448,26 @@ class HqlQueryRendererTests {
|
||||
|
||||
assertThatNoException().isThrownBy(() -> {
|
||||
parseWithoutChanges("""
|
||||
select a,
|
||||
case
|
||||
when a.geaendertAm is null then a.erstelltAm
|
||||
else a.geaendertAm end as mutationAm
|
||||
from Element a
|
||||
where a.erstelltDurch = :variable
|
||||
order by mutationAm desc nulls last
|
||||
select a,
|
||||
case
|
||||
when a.geaendertAm is null then a.erstelltAm
|
||||
else a.geaendertAm end as mutationAm
|
||||
from Element a
|
||||
where a.erstelltDurch = :variable
|
||||
order by mutationAm desc nulls last
|
||||
""");
|
||||
});
|
||||
}
|
||||
|
||||
@Test // GH-2964
|
||||
void roundFunctionShouldWorkLikeAnyOtherFunction() {
|
||||
|
||||
assertThatNoException().isThrownBy(() -> {
|
||||
parseWithoutChanges("""
|
||||
select round(count(ri) * 100 / max(ri.receipt.positions), 0) as perc
|
||||
from StockOrderItem oi
|
||||
right join StockReceiptItem ri
|
||||
on ri.article = oi.article
|
||||
""");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user