Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.18.0
Description
case:
@Test public void test() throws Exception { final String cr = "create table t (a DECIMAL)"; final String se = "select -a as aa from t"; Connection c = connect(); Statement s = c.createStatement(); s.execute(cr); s.executeQuery(se); }
error msg:
Caused by: org.codehaus.commons.compiler.CompileException: Line 21, Column 71: Object of type "java.math.BigDecimal" cannot be converted to a numeric type
public Object current() { final java.math.BigDecimal current = inputEnumerator.current() == null ? (java.math.BigDecimal) null : org.apache.calcite.runtime.SqlFunctions.toBigDecimal(inputEnumerator.current()); return current == null ? (java.math.BigDecimal) null : - current; }
`- current` is not right ,we'd better constructor a new BigDecimal object to to replace this code snippet,like
return current == null ? (java.math.BigDecimal) null : SqlFunctions.negativeDecimal(current);
Attachments
Issue Links
- depends upon
-
CALCITE-2861 Exception occurs when do arithmetic between decimal and other numeric types
- Closed
- links to