You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Ruben Quesada Lopez (JIRA)" <ji...@apache.org> on 2019/03/01 09:52:00 UTC

[jira] [Created] (CALCITE-2885) SqlValidatorImpl fails when processing a InferTypes.FIRST_KNOWN function containing a function with a dynamic parameter as first operand

Ruben Quesada Lopez created CALCITE-2885:
--------------------------------------------

             Summary: SqlValidatorImpl fails when processing a InferTypes.FIRST_KNOWN function containing a function with a dynamic parameter as first operand
                 Key: CALCITE-2885
                 URL: https://issues.apache.org/jira/browse/CALCITE-2885
             Project: Calcite
          Issue Type: Bug
    Affects Versions: 1.18.0
            Reporter: Ruben Quesada Lopez


Problem can be reproduced with adding following tests (e.g. to SqlValidatorDynamicTest.java)
{code:java}
@Test public void testDynamicParameter1() throws Exception {
  final String sql = "select 4 = 2*?";
  sql(sql).ok();
}

@Test public void testDynamicParameter2() throws Exception {
  final String sql = "select 2*? = 4";
  sql(sql).ok();
}
{code}

The first test will run successfully, but the second one (which is the same query reversing the equals operands) will fail with the exception:

{code}
org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply '*' to arguments of type '<INTEGER> * <UNKNOWN>'. Supported form(s): '<NUMERIC> * <NUMERIC>'
'<DATETIME_INTERVAL> * <NUMERIC>'
'<NUMERIC> * <DATETIME_INTERVAL>'
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)