[
https://issues.apache.org/jira/browse/CALCITE-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16988406#comment-16988406
]
Feng Zhu commented on CALCITE-3564:
-----------------------------------
[~julianhyde], Issue's description added.
I think the exception should be thrown in validation phase.
May be a new operand type checker (OperandTypes.INTEGER_INTEGER) is more
suitable.
> 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)