Skip to content

Commit

Permalink
ROUND doesn't need to be a reserved word.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gregturn committed May 22, 2023
1 parent da37737 commit 1c7a19a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,13 +1448,26 @@ void orderByWithNullsFirstOrLastShouldWork() {

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
""");
});
}
Expand Down

0 comments on commit 1c7a19a

Please sign in to comment.