From a6248a105dfb71079692a20a970e5355d1794bc9 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Mon, 3 Jun 2024 11:26:30 +0200 Subject: [PATCH] Support isNull arguments --- .../arrow/runtime/ArrowOperationPlus.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/engine/runtime-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowOperationPlus.java b/engine/runtime-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowOperationPlus.java index f542571dd6c6..0d88ad0ad7e3 100644 --- a/engine/runtime-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowOperationPlus.java +++ b/engine/runtime-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowOperationPlus.java @@ -44,9 +44,17 @@ Object execute(Object[] args, @CachedLibrary(limit = "3") InteropLibrary iop) for (long i = 0; i < len; i++) { var elem0 = iop.readArrayElement(arr0, i); var elem1 = iop.readArrayElement(arr1, i); - var l0 = iop.asLong(elem0); - var l1 = iop.asLong(elem1); - iop.invokeMember(builder, "append", l0 + l1); + Object res; + if (iop.isNull(elem0)) { + res = elem1; + } else if (iop.isNull(elem1)) { + res = elem0; + } else { + var l0 = iop.asLong(elem0); + var l1 = iop.asLong(elem1); + res = l0 + l1; + } + iop.invokeMember(builder, "append", res); } return iop.invokeMember(builder, "build"); } catch (InvalidArrayIndexException | UnknownIdentifierException ex) {