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
…2029)

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

* Code cleanup.

---------


(cherry picked from commit 6055c7e)

Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 3c8e3bd commit 2c1212e
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 2c1212e

Please sign in to comment.