Skip to content

Commit

Permalink
Fix ASCII function and groom UT for text functions. (#301) (#1895)
Browse files Browse the repository at this point in the history
* Fix `ASCII` function and groom UT for text functions.

* Code cleanup.

---------

Signed-off-by: Yury-Fridlyand <[email protected]>
(cherry picked from commit 6055c7e)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Aug 23, 2023
1 parent 3c8e3bd commit df864cb
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 df864cb

Please sign in to comment.