From ae4fdb968edfb8ae0a0d469879d3c0af66c4d22c Mon Sep 17 00:00:00 2001 From: Nathaniel Bauernfeind Date: Wed, 11 Sep 2024 19:11:03 -0600 Subject: [PATCH] further bug fix --- .../table/impl/lang/QueryLanguageParser.java | 7 ++--- .../impl/QueryTableSelectUpdateTest.java | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java index d457a4ab0b3..fd976c727fe 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java @@ -1717,10 +1717,11 @@ public Class visit(UnaryExpr n, VisitArgs printer) { // since the original expression was visited by getTypeWithCaching at the beginning of this method. final Class result = unaryOpOverloadMethod.accept(this, printer); - // Verify that the operator overload method returns the original expected type: - Assert.equals(ret, "ret", result, "result"); + // Verify that the operator overload method returns the original expected type (or its unboxed form): + Assert.equals(TypeUtils.getUnboxedTypeIfBoxed(ret), "TypeUtils.getUnboxedTypeIfBoxed(ret)", + result, "result"); - return ret; + return result; } @Override diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java index 35596b75d0e..e0035b515a7 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSelectUpdateTest.java @@ -42,6 +42,8 @@ import org.junit.Rule; import org.junit.Test; +import java.math.BigDecimal; +import java.math.BigInteger; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; @@ -1300,4 +1302,28 @@ public void testPropagationOfAttributes() { Assert.assertTrue(result.isBlink()); } } + + @Test + public void testRegressionGH5998_BigDecimal_negate() { + ExecutionContext.getContext().getQueryScope().putParam("bd_val", BigDecimal.valueOf(123.456)); + emptyTable(0).update("A = 0 < -bd_val"); + } + + @Test + public void testRegressionGH5998_BigInteger_negate() { + ExecutionContext.getContext().getQueryScope().putParam("bi_val", BigInteger.valueOf(123)); + emptyTable(0).update("A = 0 < -bi_val"); + } + + @Test + public void testRegressionGH5998_Double_QSP() { + ExecutionContext.getContext().getQueryScope().putParam("d_val", 123.456); + emptyTable(0).update("A = 0 < -d_val"); + } + + @Test + public void testRegressionGH5998_Double_NewCol() { + ExecutionContext.getContext().getQueryScope().putParam("d_val", 123.456); + emptyTable(0).update("B = d_val", "A = 0 < -B"); + } }