[
https://issues.apache.org/jira/browse/CALCITE-7156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zhen Chen updated CALCITE-7156:
-------------------------------
Description:
If OFFSET or FETCH in EnumerableLimit is BIGINT, intValue() will truncate
OFFSET or FETCH to INT_MAX. 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}
was:
If OFFSET or FETCH in EnumerableLimit is BIGINT, intValue() will truncate
OFFSET or FETCH to INT. 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}
> 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
>
> If OFFSET or FETCH in EnumerableLimit is BIGINT, intValue() will truncate
> OFFSET or FETCH to INT_MAX. 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)