[ 
https://issues.apache.org/jira/browse/CALCITE-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16992963#comment-16992963
 ] 

Rui Wang commented on CALCITE-3564:
-----------------------------------

Thanks for the issue description. It's pretty clear. Maybe should replace the 
"some functions" in title with "RAND_INTEGER".

> 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
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to