[ 
https://issues.apache.org/jira/browse/CALCITE-7181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18019910#comment-18019910
 ] 

Julian Hyde commented on CALCITE-7181:
--------------------------------------

Why only go from {{int}} to {{{}long{}}}? I would move to {{{}BigDecimal{}}}, 
which matches the literal in {{Sort.fetch}} and {{{}Sort.offset{}}}. This issue 
is caused by that impedance mismatch, so remove that mismatch.

> FETCH in SortRemoveRedundantRule do not support BIGINT
> ------------------------------------------------------
>
>                 Key: CALCITE-7181
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7181
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Zhen Chen
>            Assignee: Zhen Chen
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.41.0
>
>
> This case can not work.
> {code:java}
>   @Test void testSortRemoveWhenInputValuesMaxRowCntLessOrEqualLimitFetch2() {
>     final String sql = "select * from\n"
>         + "(VALUES 1,2,3,4,5,6) as t1 limit 3000000000";
>     sql(sql)
>         .withRule(CoreRules.SORT_REMOVE_REDUNDANT)
>         .check();
>   }
> {code}
> {code:java}
> Integer overflow: 3000000000 is out of range for INT
> java.lang.ArithmeticException: Integer overflow: 3000000000 is out of range 
> for INT
>       at org.apache.calcite.rex.RexLiteral.intValue(RexLiteral.java:1280)
>       at 
> org.apache.calcite.rel.rules.SortRemoveRedundantRule.getRowCountThreshold(SortRemoveRedundantRule.java:133)
>       at 
> org.apache.calcite.rel.rules.SortRemoveRedundantRule.onMatch(SortRemoveRedundantRule.java:117)
>       at 
> org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:350)
>       at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:527)
>       at 
> org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:419)
>       at 
> org.apache.calcite.plan.hep.HepPlanner.executeRuleInstance(HepPlanner.java:242)
>       at 
> org.apache.calcite.plan.hep.HepInstruction$RuleInstance$State.execute(HepInstruction.java:178)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to