Skip to content

Commit

Permalink
further bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauernfeind committed Sep 12, 2024
1 parent c0ca449 commit ae4fdb9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
}

0 comments on commit ae4fdb9

Please sign in to comment.