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

Zhen Chen commented on CALCITE-7156:
------------------------------------

Currently, Calcite's computation relies on linq4j. In the implementation of 
order by, a List is used, and the maximum number of elements that can be stored 
in a List is Integer.MAX_VALUE. This may be the reason why offset and fetch 
were both implemented as int previously. Now, supporting bigint for offset and 
fetch may involve refactoring the computation logic, which could be quite 
challenging. Is there a better solution for this?

> OFFSET and FETCH in EnumerableLimit need to support BIGINT
> ----------------------------------------------------------
>
>                 Key: CALCITE-7156
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7156
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Zhen Chen
>            Priority: Major
>              Labels: pull-request-available
>
> If OFFSET or FETCH in EnumerableLimit is BIGINT, intValue() will overflow. 
> Since CALCITE-7154 has fixed, it need to be change to longValue().
> {code:java}
>   static Expression getExpression(RexNode rexNode) {
>     if (rexNode instanceof RexDynamicParam) {
>       final RexDynamicParam param = (RexDynamicParam) rexNode;
>       return Expressions.convert_(
>           Expressions.call(DataContext.ROOT,
>               BuiltInMethod.DATA_CONTEXT_GET.method,
>               Expressions.constant("?" + param.getIndex())),
>           Integer.class);
>     } else {
>       return Expressions.constant(RexLiteral.intValue(rexNode)); <--- here
>     }
>   }
> {code}



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

Reply via email to