Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.29.0
Description
This query:
// Does not run @Test void testDynamicParameterLimit() { CalciteAssert.hr() .query("SELECT * FROM \"hr\".\"emps\" AS a " + "WHERE \"deptno\" = " + "(SELECT MAX(\"deptno\") " + "FROM \"hr\".\"emps\" AS b " + "WHERE a.\"empid\" = b.\"empid\"" + ") LIMIT ?") .runs(); }
results in the following exception:
not a literal: ?0 java.lang.AssertionError: not a literal: ?0 at org.apache.calcite.rex.RexLiteral.findValue(RexLiteral.java:1208) at org.apache.calcite.rex.RexLiteral.intValue(RexLiteral.java:1183) at org.apache.calcite.sql2rel.RelDecorrelator.decorrelateRel(RelDecorrelator.java:481) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531) at org.apache.calcite.sql2rel.RelDecorrelator.getInvoke(RelDecorrelator.java:711) at org.apache.calcite.sql2rel.RelDecorrelator.decorrelate(RelDecorrelator.java:306) at org.apache.calcite.sql2rel.RelDecorrelator.decorrelateQuery(RelDecorrelator.java:230) at org.apache.calcite.tools.Programs$DecorrelateProgram.run(Programs.java:361) at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:336) at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:177) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:312) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:220)
Attachments
Issue Links
- is related to
-
CALCITE-5286 Join with parameterized LIMIT throws AssertionError "not a literal"
- Closed
-
CALCITE-2061 Dynamic parameters in OFFSET, FETCH and LIMIT clauses
- Closed
- relates to
-
CALCITE-5091 RelMdRowCount can return more accurate rowCount when fetch is deterministic and offset is dynamic
- Closed
- links to