[jira] [Comment Edited] (CALCITE-6246) Unable to find the correct function signature when using named parameters with omitting arguments
[ https://issues.apache.org/jira/browse/CALCITE-6246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815144#comment-17815144 ] Feng Jin edited comment on CALCITE-6246 at 2/7/24 7:43 AM: --- [~eveywu] Thank you for your reply. I have confirmed that the example I provided above cannot reproduce the problem. The reason for the above exception is that I did not set the second parameter of MY_DET_PLUS as optional. In fact, we encountered this problem in Flink, which may be related to Flink's implementation. I will close this issue first until I find a more appropriate way to reproduce it. was (Author: hackergin): [~eveywu] Thank you for your reply. I have confirmed that the example I provided above cannot be reproduced. The reason for the above exception is that I did not set the second parameter of MY_DET_PLUS as optional. In fact, we encountered this problem in Flink, which may be related to Flink's implementation. I will close this issue first until I find a more appropriate way to reproduce it. > Unable to find the correct function signature when using named parameters > with omitting arguments > - > > Key: CALCITE-6246 > URL: https://issues.apache.org/jira/browse/CALCITE-6246 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Feng Jin >Assignee: Feng Jin >Priority: Major > > When we use named parameters, if a non-mandatory parameter is omitted, it > will be automatically filled with a DEFAULT node. However, the default return > type of the DEFAULT node is ANY. This will cause some issues when inferring > the function signature. > Take the unit test below as an example. > org.apache.calcite.test.UdfTest#testScalarFunctionWithParameterWithOptional > {code:java} > // Some comments here > @Test void testScalarFunctionWithParameterWithOptional() { > final String sql = "select \"adhoc\".my_det_plus() as p\n" > + "from \"adhoc\".EMPLOYEES"; > final AtomicInteger c = > Smalls.MyDeterministicPlusFunction.INSTANCE_COUNT.get(); > final int before = c.get(); > withUdf() > .with("caseSensitive", false) > .query(sql).returnsUnordered("P=110", > "P=120", > "P=110", > "P=110"); > final int after = c.get(); > assertThat(after, is(before + 1)); > } > {code} > We will get the following error: > {code:shell} > java.sql.SQLException: Error while executing SQL "select > "adhoc".my_det_plus() as p > from "adhoc".EMPLOYEES": From line 1, column 16 to line 1, column 28: No > match found for function signature MY_DET_PLUS() > at org.apache.calcite.avatica.Helper.createException(Helper.java:56) > at org.apache.calcite.avatica.Helper.createException(Helper.java:41) > at > org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164) > at > org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228) > at > org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:543) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1455) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1394) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1453) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1443) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1465) > at > org.apache.calcite.test.UdfTest.testScalarFunctionWithParameterWithOptional(UdfTest.java:242) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727) > at > org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) > at > org.junit.jupiter.engine.extension.SameThreadTimeoutInvocation.proceed(SameThreadTimeoutInvocation.java:45) > at > org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156) > at > org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147) > at > org.junit.jupiter.engine.extension.TimeoutEx
[jira] [Comment Edited] (CALCITE-6246) Unable to find the correct function signature when using named parameters with omitting arguments
[ https://issues.apache.org/jira/browse/CALCITE-6246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815107#comment-17815107 ] EveyWu edited comment on CALCITE-6246 at 2/7/24 5:51 AM: -- hi [~hackergin] , I can't reproduce this case. In my opinion, function validation can obtain the correct parameter type. Details can be viewed: SqlFunction#deriveType {code:java} final List argTypes = constructArgTypeList(validator, scope,call, args, convertRowArgToColumnList); //.. throw validator.handleUnresolvedFunction(call, this, argTypes, argNames); {code} was (Author: eveywu): I can't reproduce this case. In my opinion, function validation can obtain the correct parameter type. Details can be viewed: SqlFunction#deriveType {code:java} final List argTypes = constructArgTypeList(validator, scope,call, args, convertRowArgToColumnList); //.. throw validator.handleUnresolvedFunction(call, this, argTypes, argNames); {code} > Unable to find the correct function signature when using named parameters > with omitting arguments > - > > Key: CALCITE-6246 > URL: https://issues.apache.org/jira/browse/CALCITE-6246 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Feng Jin >Assignee: Feng Jin >Priority: Major > > When we use named parameters, if a non-mandatory parameter is omitted, it > will be automatically filled with a DEFAULT node. However, the default return > type of the DEFAULT node is ANY. This will cause some issues when inferring > the function signature. > Take the unit test below as an example. > org.apache.calcite.test.UdfTest#testScalarFunctionWithParameterWithOptional > {code:java} > // Some comments here > @Test void testScalarFunctionWithParameterWithOptional() { > final String sql = "select \"adhoc\".my_det_plus() as p\n" > + "from \"adhoc\".EMPLOYEES"; > final AtomicInteger c = > Smalls.MyDeterministicPlusFunction.INSTANCE_COUNT.get(); > final int before = c.get(); > withUdf() > .with("caseSensitive", false) > .query(sql).returnsUnordered("P=110", > "P=120", > "P=110", > "P=110"); > final int after = c.get(); > assertThat(after, is(before + 1)); > } > {code} > We will get the following error: > {code:shell} > java.sql.SQLException: Error while executing SQL "select > "adhoc".my_det_plus() as p > from "adhoc".EMPLOYEES": From line 1, column 16 to line 1, column 28: No > match found for function signature MY_DET_PLUS() > at org.apache.calcite.avatica.Helper.createException(Helper.java:56) > at org.apache.calcite.avatica.Helper.createException(Helper.java:41) > at > org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164) > at > org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228) > at > org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:543) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1455) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1394) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1453) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1443) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1465) > at > org.apache.calcite.test.UdfTest.testScalarFunctionWithParameterWithOptional(UdfTest.java:242) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727) > at > org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) > at > org.junit.jupiter.engine.extension.SameThreadTimeoutInvocation.proceed(SameThreadTimeoutInvocation.java:45) > at > org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156) > at > org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147) > at > org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86) > at > org.junit.jupiter
[jira] [Comment Edited] (CALCITE-6246) Unable to find the correct function signature when using named parameters with omitting arguments
[ https://issues.apache.org/jira/browse/CALCITE-6246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815107#comment-17815107 ] EveyWu edited comment on CALCITE-6246 at 2/7/24 5:50 AM: -- I can't reproduce this case. In my opinion, function validation can obtain the correct parameter type. Details can be viewed: SqlFunction#deriveType {code:java} final List argTypes = constructArgTypeList(validator, scope,call, args, convertRowArgToColumnList); //.. throw validator.handleUnresolvedFunction(call, this, argTypes, argNames); {code} was (Author: eveywu): I can't reproduce this case. In my opinion, function validation can obtain the correct parameter type. Details can be viewed: SqlFunction#deriveType ``` final List argTypes = constructArgTypeList(validator, scope,call, args, convertRowArgToColumnList); throw validator.handleUnresolvedFunction(call, this, argTypes, argNames); ``` > Unable to find the correct function signature when using named parameters > with omitting arguments > - > > Key: CALCITE-6246 > URL: https://issues.apache.org/jira/browse/CALCITE-6246 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Feng Jin >Assignee: Feng Jin >Priority: Major > > When we use named parameters, if a non-mandatory parameter is omitted, it > will be automatically filled with a DEFAULT node. However, the default return > type of the DEFAULT node is ANY. This will cause some issues when inferring > the function signature. > Take the unit test below as an example. > org.apache.calcite.test.UdfTest#testScalarFunctionWithParameterWithOptional > {code:java} > // Some comments here > @Test void testScalarFunctionWithParameterWithOptional() { > final String sql = "select \"adhoc\".my_det_plus() as p\n" > + "from \"adhoc\".EMPLOYEES"; > final AtomicInteger c = > Smalls.MyDeterministicPlusFunction.INSTANCE_COUNT.get(); > final int before = c.get(); > withUdf() > .with("caseSensitive", false) > .query(sql).returnsUnordered("P=110", > "P=120", > "P=110", > "P=110"); > final int after = c.get(); > assertThat(after, is(before + 1)); > } > {code} > We will get the following error: > {code:shell} > java.sql.SQLException: Error while executing SQL "select > "adhoc".my_det_plus() as p > from "adhoc".EMPLOYEES": From line 1, column 16 to line 1, column 28: No > match found for function signature MY_DET_PLUS() > at org.apache.calcite.avatica.Helper.createException(Helper.java:56) > at org.apache.calcite.avatica.Helper.createException(Helper.java:41) > at > org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164) > at > org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228) > at > org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:543) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1455) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1394) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1453) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1443) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1465) > at > org.apache.calcite.test.UdfTest.testScalarFunctionWithParameterWithOptional(UdfTest.java:242) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727) > at > org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) > at > org.junit.jupiter.engine.extension.SameThreadTimeoutInvocation.proceed(SameThreadTimeoutInvocation.java:45) > at > org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156) > at > org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147) > at > org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86) > at > org.junit.jupiter.engine.execution.InterceptingExe