Skip to content

Commit

Permalink
Fix ASCII function and groom UT for text functions. (#301) (opensea…
Browse files Browse the repository at this point in the history
…rch-project#1895)

* Fix `ASCII` function and groom UT for text functions.



* Code cleanup.



---------

Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand authored Aug 21, 2023
1 parent 2201509 commit 6055c7e
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ private static ExprValue exprLeft(ExprValue expr, ExprValue length) {
}

private static ExprValue exprAscii(ExprValue expr) {
return new ExprIntegerValue((int) expr.stringValue().charAt(0));
return new ExprIntegerValue(
expr.stringValue().length() == 0 ? 0 : (int) expr.stringValue().charAt(0));
}

private static ExprValue exprLocate(ExprValue subStr, ExprValue str) {
Expand Down
Loading

0 comments on commit 6055c7e

Please sign in to comment.