[
https://issues.apache.org/jira/browse/CALCITE-7181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18019983#comment-18019983
]
Zhen Chen commented on CALCITE-7181:
------------------------------------
I understand your point; theoretically, there shouldn’t be a restriction on
FETCH and OFFSET. I also understand why it makes sense to use the more general
BigDecimal type at the Java level. I have another question: since there doesn’t
seem to be a BigDecimal type at the SQL level, but we still need a type to
represent integers in SQL, what would be the most appropriate choice?
> 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)