Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
values power(0.5, 2);
fails like
> java.sql.SQLException: Error while executing SQL "values power(0.5, 2)": while resolving method 'power[class java.math.BigDecimal, int]' in class class org.apache.calcite.runtime.SqlFunctions > at org.apache.calcite.avatica.Helper.createException(Helper.java:56) > at org.apache.calcite.avatica.Helper.createException(Helper.java:41) > at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) > at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) > at net.hydromatic.quidem.Quidem.checkResult(Quidem.java:322) > at net.hydromatic.quidem.Quidem.access$2800(Quidem.java:54) > at net.hydromatic.quidem.Quidem$ContextImpl.checkResult(Quidem.java:1747) > at net.hydromatic.quidem.Quidem$CheckResultCommand.execute(Quidem.java:1078) > at net.hydromatic.quidem.Quidem$CompositeCommand.execute(Quidem.java:1548) > at net.hydromatic.quidem.Quidem.execute(Quidem.java:216) > at org.apache.calcite.test.QuidemTest.checkRun(QuidemTest.java:175) > at org.apache.calcite.test.CoreQuidemTest.testSqlMisc(CoreQuidemTest.java:67) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > at org.apache.calcite.test.QuidemTest.test(QuidemTest.java:210) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runners.Suite.runChild(Suite.java:128) > at org.junit.runners.Suite.runChild(Suite.java:27) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > Caused by: java.lang.RuntimeException: while resolving method 'power[class java.math.BigDecimal, int]' in class class org.apache.calcite.runtime.SqlFunctions > at org.apache.calcite.linq4j.tree.Types.lookupMethod(Types.java:347) > at org.apache.calcite.linq4j.tree.Expressions.call(Expressions.java:444) > at org.apache.calcite.adapter.enumerable.RexImpTable$MethodNameImplementor.implement(RexImpTable.java:1876) > at org.apache.calcite.adapter.enumerable.RexImpTable.implementCall(RexImpTable.java:982) > at org.apache.calcite.adapter.enumerable.RexImpTable.implementNullSemantics(RexImpTable.java:952) > at org.apache.calcite.adapter.enumerable.RexImpTable.implementNullSemantics0(RexImpTable.java:864) > at org.apache.calcite.adapter.enumerable.RexImpTable.lambda$createImplementor$3(RexImpTable.java:521) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateCall(RexToLixTranslator.java:727) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:699) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate0(RexToLixTranslator.java:664) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:221) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:216) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateList(RexToLixTranslator.java:897) > at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateProjects(RexToLixTranslator.java:193) > at org.apache.calcite.adapter.enumerable.EnumerableCalc.implement(EnumerableCalc.java:187) > at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:99) > at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92) > at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1237) > at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:331) > at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230) > at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:772) > at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:636) > at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:606) > at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:229) > at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:550) > at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675) > at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156) > ... 49 more > Caused by: java.lang.NoSuchMethodException: org.apache.calcite.runtime.SqlFunctions.power(java.math.BigDecimal, int) > at java.base/java.lang.Class.getMethod(Class.java:2085) > at org.apache.calcite.linq4j.tree.Types.lookupMethod(Types.java:338) > ... 76 more at org.junit.Assert.fail(Assert.java:88) at org.apache.calcite.test.QuidemTest.checkRun(QuidemTest.java:179) at org.apache.calcite.test.CoreQuidemTest.testSqlMisc(CoreQuidemTest.java:67) ... 40 more
after checking org.apache.calcite.runtime.SqlFunctions found that the same issue is present for
values atan2(0.5, 2);
I guess to fix it it is enough to add methods like
public static double power(BigDecimal b0, long b1) { return Math.pow(b0.doubleValue(), b1); }
Attachments
Issue Links
- links to