[
https://issues.apache.org/jira/browse/CALCITE-2885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ruben Quesada Lopez updated CALCITE-2885:
-----------------------------------------
Description:
Problem can be reproduced by 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 equality 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}
was:
Problem can be reproduced by 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 equality 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}
> SqlValidatorImpl fails when processing an 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
> Priority: Major
>
> Problem can be reproduced by 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 equality 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)