[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17823558#comment-17823558 ] Jeyhun Karimov commented on CALCITE-6266: - Hi [~julianhyde] do you have any other hints/suggestions/comments about the issue/PR? Thanks > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > Labels: pull-request-available > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} and {{calcite-1.30.0}} but > fails on other releases, including the main branch > (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) > at > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68) > at >
[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817844#comment-17817844 ] Sergey Nuyanzin commented on CALCITE-6266: -- it seems I found the reason in a new version this part is absent now in \{{JoinTable}} {code:java} { joinType = JoinType.COMMA.symbol(getPos()); } e2 = TableRef() { return new SqlJoin(joinType.getParserPosition(), e, SqlLiteral.createBoolean(false, joinType.getParserPosition()), joinType, e2, JoinConditionType.NONE.symbol(SqlParserPos.ZERO), null); } {code} After adding it back the tests becomes passing. The only side effect is extra quote for {{inner join}} like in {{testMixedFrom}} before {code:java} sql("select * from a join b using (x), c join d using (y)") .ok("SELECT *\n" + "FROM `A`\n" + "INNER JOIN `B` USING (`X`),\n" + "`C`\n" + "INNER JOIN `D` USING (`Y`)"); {code} and after {code:java} sql("select * from a join b using (x), c join d using (y)") .ok("SELECT *\n" + "FROM (`A` INNER JOIN `B` USING (`X`), `C`)\n" + "INNER JOIN `D` USING (`Y`)"); {code} any hint how to cope with this would be great > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > Labels: pull-request-available > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} and {{calcite-1.30.0}} but > fails on other releases, including the main branch > (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at >
[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817818#comment-17817818 ] Sergey Nuyanzin commented on CALCITE-6266: -- it seems it fails for both {quote} If you change "ramp(deptno)" to "ramp(dept.deptno)", do things improve? {quote} it fails as {noformat} org.apache.calcite.sql.validate.SqlValidatorException: Table 'DEPT' not found at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ... {noformat} for {code:sql} select * from (dept, lateral table(ramp(deptno))) CROSS JOIN (VALUES ('A'), ('B')) {code} it fails as {noformat} org.apache.calcite.sql.parser.impl.ParseException: Encountered "," at line 1, column 20. Was expecting one of: "AS" ... "CROSS" ... "EXTEND" ... ... {noformat} > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} and {{calcite-1.30.0}} but > fails on other releases, including the main branch > (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) > at >
[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817803#comment-17817803 ] Julian Hyde commented on CALCITE-6266: -- That makes sense. I had the same hypothesis. But if the hypothesis were correct, the query with parentheses {code:java} select * from (dept, lateral table(ramp(deptno))) CROSS JOIN (VALUES ('A'), ('B')) {code} would succeed, because "ramp(deptno)" would be evaluated in a context where "dept" is available. Since it fails, I don't know what's going on. If you change "ramp(deptno)" to "ramp(dept.deptno)", do things improve? > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} and {{calcite-1.30.0}} but > fails on other releases, including the main branch > (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) > at > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) > at >
[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817802#comment-17817802 ] Jeyhun Karimov commented on CALCITE-6266: - Hi [~julianhyde] IMO presedence might not be the main issue. The following query with parentheses also fails: {code:java} select * from (dept, lateral table(ramp(deptno))) CROSS JOIN (VALUES ('A'), ('B')) {code} I think we parse the comma-join different than other joins (cross, left, right,...). For comma join, we parse before and after comma. In this case it will be: {code:java} left=(DEPT) right=SELECT * FROM LATERAL TABLE(RAMP(`DEPTNO`)) CROSS JOIN (VALUES ROW('A'), ROW('B')) {code} and {{right}} will be further divided into {code:java} left = LATERAL TABLE(RAMP(`DEPTNO`)) right=VALUES ROW('A'),ROW('B') {code} which throws validation exception. So, basically a query {{FROM}} clause "{{FROM A, B cross join C}}" is parsed as "{{(A cross join (B cross join C))}}" whereas "{{FROM A cross join B cross join C}}" is parsed as {{((A cross join B) cross join C)}}. That is why, we get a problem when we have a Lateral table inside a join expression. WDYT? > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} and {{calcite-1.30.0}} but > fails on other releases, including the main branch > (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) > at >
[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817764#comment-17817764 ] Julian Hyde commented on CALCITE-6266: -- It's quite possible that the new behavior is correct, and the query was always invalid. I don't know which has higher precedence, ',' or {{CROSS JOIN}}, but maybe it changed in CALCITE-35. Adding parentheses might be required to make the query correct. Can you investigate? > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.31.0, 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} and {{calcite-1.30.0}} but > fails on other releases, including the main branch > (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) > at > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138) >
[jira] [Commented] (CALCITE-6266) SqlValidatorException with LATERAL TABLE and JOIN
[ https://issues.apache.org/jira/browse/CALCITE-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817664#comment-17817664 ] Sergey Nuyanzin commented on CALCITE-6266: -- bisect shows it comes with CALCITE-35 > SqlValidatorException with LATERAL TABLE and JOIN > - > > Key: CALCITE-6266 > URL: https://issues.apache.org/jira/browse/CALCITE-6266 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.32.0, 1.33.0, 1.34.0, 1.35.0, 1.36.0 >Reporter: Jeyhun Karimov >Priority: Critical > > I have the following test in SqlValidatorTest.java > {code:java} > @Test void test() { > sql("select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))") > .ok(); > } > {code} > This test passes on Calcite {{calcite-1.29.0}} but fails on other releases, > including the main branch (c774c313a81d01c4e3e77cf296d04839c5ab04c0). The > exception is: > {code:java} > org.opentest4j.AssertionFailedError: Validator threw unexpected exception; > query [select * from dept, lateral table(ramp(deptno)) CROSS JOIN (VALUES > ('A'), ('B'))]; exception [Column 'DEPTNO' not found in any table]; class > [class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 > col 40 thru line 1 col 40] > at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38) > at org.junit.jupiter.api.Assertions.fail(Assertions.java:135) > at org.apache.calcite.sql.test.SqlTests.checkEx(SqlTests.java:352) > at > org.apache.calcite.sql.test.AbstractSqlTester.assertExceptionIsThrown(AbstractSqlTester.java:112) > at > org.apache.calcite.test.SqlValidatorFixture.ok(SqlValidatorFixture.java:191) > at > org.apache.calcite.test.SqlValidatorTest.jey2(SqlValidatorTest.java:284) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > 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.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) > at > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) > at > org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) > at > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138) > at > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68) > at > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) > at >