xiedeyantu commented on PR #4754:
URL: https://github.com/apache/calcite/pull/4754#issuecomment-3765285350

   After using the changes made in this PR, this case no longer works properly.
   ```
   # [CALCITE-709] Errors with LIMIT inside scalar sub-query
   !use scott
   select deptno, (select sum(empno) from "scott".emp where deptno = 
dept.deptno limit 0) as x from "scott".dept;
   +--------+---+
   | DEPTNO | X |
   +--------+---+
   |     10 |   |
   |     20 |   |
   |     30 |   |
   |     40 |   |
   +--------+---+
   (4 rows)
   
   !ok
   ```
   > Caused by: java.lang.ArithmeticException: Value 38216 out of range
   >    at 
org.apache.calcite.linq4j.tree.Primitive.checkRoundedRange(Primitive.java:387)
   >    at 
org.apache.calcite.linq4j.tree.Primitive.numberValue(Primitive.java:564)
   >    at 
org.apache.calcite.linq4j.tree.Primitive.numberValueRoundDown(Primitive.java:539)
   >    at Baz$3.apply(Unknown Source)
   >    at Baz$3.apply(Unknown Source)
   >    at Baz$3.apply(Unknown Source)
   >    at 
org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory$AccumulatorAdderSeq.apply(BasicAggregateLambdaFactory.java:81)
   >    at 
org.apache.calcite.linq4j.EnumerableDefaults.groupBy_(EnumerableDefaults.java:1177)
   >    at 
org.apache.calcite.linq4j.EnumerableDefaults.groupBy(EnumerableDefaults.java:782)
   >    at 
org.apache.calcite.linq4j.DefaultEnumerable.groupBy(DefaultEnumerable.java:312)
   >    at Baz.bind(Unknown Source)
   >    at 
org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:367)
   >    at 
org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:335)
   >    at 
org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:609)
   >    at 
org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:600)
   >    at 
org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:184)
   >    at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:64)
   >    at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:43)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to