You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Feng Zhu (Jira)" <ji...@apache.org> on 2019/12/05 02:51:00 UTC

[jira] [Updated] (CALCITE-3564) Make operand type check accurate for some functions in validation phase

     [ https://issues.apache.org/jira/browse/CALCITE-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Feng Zhu updated CALCITE-3564:
------------------------------
    Description: 
For some functions, it is too late to fail the query in runtime phase.


 For example: _*RAND_INTEGER*_ adopts _*OperandTypes.or(OperandTypes.NUMERIC, OperandTypes.NUMERIC_NUMERIC)*_
{code:java}
@Test public void test2() {
 final String sql = "SELECT rand_integer(1.1, 2)";
 CalciteAssert.that()
 .query(sql)
 .planContains("xyxyx")
 .returns("EXPR$0={\"x\":1,\"y\":2.1}\n");
 }{code}
We will get:
{code:java}
org.codehaus.commons.compiler.CompileException: Line 22, Column 100: No applicable constructor/method found for actual parameters "java.math.BigDecimal, int"; candidates are: "public int org.apache.calcite.runtime.RandomFunction.randIntegerSeed(int, int)"
 at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
 at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:9263)
 at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9123){code}
 

> Make operand type check accurate for some functions in validation phase
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-3564
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3564
>             Project: Calcite
>          Issue Type: Sub-task
>            Reporter: Feng Zhu
>            Priority: Major
>
> For some functions, it is too late to fail the query in runtime phase.
>  For example: _*RAND_INTEGER*_ adopts _*OperandTypes.or(OperandTypes.NUMERIC, OperandTypes.NUMERIC_NUMERIC)*_
> {code:java}
> @Test public void test2() {
>  final String sql = "SELECT rand_integer(1.1, 2)";
>  CalciteAssert.that()
>  .query(sql)
>  .planContains("xyxyx")
>  .returns("EXPR$0={\"x\":1,\"y\":2.1}\n");
>  }{code}
> We will get:
> {code:java}
> org.codehaus.commons.compiler.CompileException: Line 22, Column 100: No applicable constructor/method found for actual parameters "java.math.BigDecimal, int"; candidates are: "public int org.apache.calcite.runtime.RandomFunction.randIntegerSeed(int, int)"
>  at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
>  at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:9263)
>  at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:9123){code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)